開始界面:
訂餐:
#include<stdio.h>
#include<stdlib.h>
static int n=1;
static int key=0;
static int s[80];
static int f[80];
static char name[80][20];
static int num[80];/*使用static記憶模式*/
void Input();
void Put();
void Mod();
void Delete();
void Password();
void Time();
void Copyrigt();
void System();
void main()
{
system("color 0B");
int choice;
system("CLS");/*清屏函數(shù),使顯示更美觀*/
printf("nnnttt????? 歡迎進(jìn)入無邊訂餐系統(tǒng)!nn");
printf("ttttt????? 當(dāng)前訂餐人數(shù):%dn",n-1);
printf("tt╔═════════════════════╗n");
printf("tt║????? 1=>客戶訂餐???????????????????????? ║n");
printf("tt║????? 2=>信息查詢???????????????????????? ║n");
printf("tt║????? 3=>信息修改 (權(quán)限)??????????????? ║n");
printf("tt║????? 4=>信息退訂 (權(quán)限)??????????????? ║n");
printf("tt║????? 5=>操作密碼 (權(quán)限)??????????????? ║n");
printf("tt║????? 6=>軟件版權(quán)???????????????????????? ║n");
printf("tt║????? 7=>系統(tǒng)退出???????????????????????? ║n");
printf("tt╚═════════════════════╝n");
printf("ntt請輸入您要進(jìn)行的操作(1-7):[ ]bb");
do{
scanf("%d",&choice);
if(1>choice||choice>7)
{
printf("ttt您的輸入有誤,請重新輸入!");
printf("nttt請輸入您要進(jìn)行的操作(1-7):[ ]bb");
}
}while(1>choice||choice>7);
switch(choice)/*使用switch進(jìn)行跳轉(zhuǎn)*/
{
case 1:Input();break;/*進(jìn)入輸入模塊*/
case 2:Put();break;/*進(jìn)入顯示模塊*/
case 3:Mod();break;/*進(jìn)入修改模塊*/
case 4:Delete();break;/*進(jìn)入刪除模塊*/
case 5:Password();break;/*進(jìn)入密碼模塊*/
case 6:Copyrigt();break;/*進(jìn)入版權(quán)模塊*/
case 7:break;break;/*系統(tǒng)退出*/
default:System();/*系統(tǒng)退出*/
}
}
void System()
{
system("exit");
}
/*輸入模塊*/
void Input()
{
int Options,*p;
system("CLS");/*清屏函數(shù),使顯示更美觀*/
fh: for(;n<100;)
{
pd:? system("CLS");
printf("nnnnttt時(shí)間(時(shí):分)t");
scanf("ttt%d:%d",&s[n],&f[n]);
if(s[n]>24||f[n]>59) /*時(shí)間數(shù)字判斷*/
{
printf("ttt時(shí)間有誤,請重新輸入!n");
goto pd;
}
printf("ttt姓名:t");
scanf("ttt%s",&name[n]);
printf("ttt人數(shù):t");
scanf("ttt%d",&num[n]);
n=n+1;
printf("ttt-------------------------n");
printf("ttt請選擇下一步操作:nttt1=>繼續(xù)錄入nttt2=>退出到主界面nttt[ ]bb");/*多部選擇,可重復(fù)錄入*/
scanf("%d",&Options);
if(Options==1) goto fh;
else main();/*返回到主界面*/
}
}
/*輸出模塊*/
void Put()
{
int j,Options,m;
cx: system("CLS");
printf("nnnnttt請輸入要查詢的方式:nttt0=>全部查詢nttt1=>按編號查詢nttt2=>按用餐時(shí)間查詢nttt3=>按用餐人數(shù)查詢nttt[ ]bb");/*提供種查詢機(jī)制*/
scanf("%d",&j);
system("CLS");
switch(j)
{
case 0:
printf("nnnnttt編號t時(shí)間t姓名t人數(shù)n");
for(m=1;m<n;m++)
{
printf("ttt? %dt%d:%2.2dt%st? %dn",m,s[m],f[m],name[m],num[m]);
}
printf("nttt查詢完畢!n");break;
case 1:
printf("nnnnttt請輸入編號:[ ]bb");
scanf("%d",&j);
system("CLS");
printf("nnnnttt編號t時(shí)間t姓名t人數(shù)n");
printf("ttt? %dt%d:%2.2dt%st? %dn",j,s[j],f[j],name[j],num[j]);
printf("nttt查詢完畢!n");break;
case 2:Time();break;
case 3:printf("nnnnttt暫未載入模塊!n");break;
default :printf("nnnnttt您輸入的有誤!n");break;
}
printf("ttt-------------------------n");
printf("ttt請選擇下一步操作:nttt1=>繼續(xù)查詢nttt2=>退出到主界面nttt[ ]bb");
scanf("%d",&Options);
if(Options==1) goto cx;
else main();/*返回到主界面*/
}