|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#define N 20 /*<2A>궨<EFBFBD>壺20̨<30><CCA8><EFBFBD><EFBFBD>*/
|
|
|
|
|
#define T ((time-8)/2) /*<2A>궨<EFBFBD>壺<EFBFBD><E5A3BA>timeת<65><D7AA>Ϊʱ<CEAA><CAB1><EFBFBD><EFBFBD>*/
|
|
|
|
|
int sum[6]={20,20,20,20,20,20}; /*<2A><>ʼ״̬*/
|
|
|
|
|
int computer[6][20]={
|
|
|
|
|
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
|
|
|
|
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
|
|
|
|
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
|
|
|
|
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
|
|
|
|
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
|
|
|
|
|
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}}; /*<2A><>ʼ״̬<D7B4><CCAC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>*/
|
|
|
|
|
void Menu(); /*<2A><><EFBFBD><EFBFBD><EFBFBD>溯<EFBFBD><E6BAAF>*/
|
|
|
|
|
void Situation(); /*ʱ<><CAB1><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>*/
|
|
|
|
|
void Book(); /*Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void Cancel(); /*ȡ<><C8A1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void SearchWaiting(); /*<2A>鿴<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
|
|
|
|
void detail(int time); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void prione(int i); /*ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>*/
|
|
|
|
|
struct waitlist /*<2A>ṹ<EFBFBD><E1B9B9>ʵ<EFBFBD>ֵȴ<D6B5><C8B4>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
char number[3]; /*Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
char telephonenumber[11]; /*Ԥ<><D4A4><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>*/
|
|
|
|
|
} wait[N];
|
|
|
|
|
void printone(int i); /*ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>Ļ*/
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
Menu(); /*<2A><>ǰ״̬<D7B4><CCAC><EFBFBD><EFBFBD>*/
|
|
|
|
|
}
|
|
|
|
|
void Menu() /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
int n,w;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
puts("\t\t****************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λԤԼϵͳ*********************\n");
|
|
|
|
|
puts("\t\t********************<2A>˵<EFBFBD>*****************************\n");
|
|
|
|
|
puts("\t\t\t |1.<2E><>ѯijʱ<C4B3><CAB1><EFBFBD>λ<EFBFBD>λ״̬|"); /*<2A><>ѯijʱ<C4B3><CAB1><EFBFBD>λ<EFBFBD>λ״̬*/
|
|
|
|
|
puts("\t\t\t |2.Ԥ<><D4A4><EFBFBD>ջ<EFBFBD>λ\t\t|"); /*Ԥ<><D4A4><EFBFBD>ջ<EFBFBD>λ*/
|
|
|
|
|
puts("\t\t\t |3.ȡ<><C8A1>Ԥ<EFBFBD><D4A4> \t\t|"); /*ȡ<><C8A1>Ԥ<EFBFBD><D4A4>*/
|
|
|
|
|
puts("\t\t\t |4.<2E><>ѯ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>Ϣ \t|"); /*<2A><>ѯ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>Ϣ*/
|
|
|
|
|
puts("\t\t\t |5.<2E>˳<EFBFBD> \t\t|\n"); /*<2A>˳<EFBFBD>*/
|
|
|
|
|
puts("\t\t*****************************************************\n");
|
|
|
|
|
printf("ѡ<EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>(1-5):");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
if(n<1||n>5)
|
|
|
|
|
{w=1;printf("<EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");getchar();}
|
|
|
|
|
else
|
|
|
|
|
w=0;
|
|
|
|
|
}while(w==1);
|
|
|
|
|
switch(n)
|
|
|
|
|
{
|
|
|
|
|
case 1:Situation();break;
|
|
|
|
|
case 2:Book();break;
|
|
|
|
|
case 3:Cancel();break;
|
|
|
|
|
case 4:SearchWaiting();break;
|
|
|
|
|
case 5:exit(0);break;
|
|
|
|
|
}
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
/*ʱ<><CAB1><EFBFBD><EFBFBD>ѯ*/
|
|
|
|
|
void Situation()
|
|
|
|
|
{
|
|
|
|
|
int time;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (8-20)<29><>Χ<EFBFBD>ڵ<EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
if(time<8||time>20)
|
|
|
|
|
{printf("\tʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (8-20)<29><>Χ<EFBFBD>ڵ<EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
}
|
|
|
|
|
detail(time); /*<2A><><EFBFBD><EFBFBD>detail<69><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>λ*/
|
|
|
|
|
getchar();
|
|
|
|
|
Menu();
|
|
|
|
|
}
|
|
|
|
|
/*Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void Book()
|
|
|
|
|
{
|
|
|
|
|
int time,i=0,x,y;
|
|
|
|
|
FILE *fp; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ָ<EFBFBD><D6B8>*/
|
|
|
|
|
char c;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>(8-20)ʱ<>䷶Χ<E4B7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<D2AA><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
if(time<8||time>20)
|
|
|
|
|
{
|
|
|
|
|
printf("\tʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD>(8-20)ʱ<>䷶Χ<E4B7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<D2AA><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
}
|
|
|
|
|
detail(time); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀǰ<C4BF>õ<EFBFBD><C3B5><EFBFBD>*/
|
|
|
|
|
if(sum[T]>0) /*<2A><>ʱ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD>δ<EFBFBD><CEB4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD>*/
|
|
|
|
|
{ if((fp=fopen("waitlist.txt","a"))==NULL) /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ绰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s %s",wait[i].number,wait[i].telephonenumber); /*¼<><C2BC>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
//for(i=0;i<1;i++)
|
|
|
|
|
fwrite(&wait[i],sizeof(struct waitlist),1,fp); /*<2A><><EFBFBD>ı<EFBFBD><C4B1>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ṹ<EFBFBD>嵥Ԫ*/
|
|
|
|
|
fclose(fp); /*<2A>ر<EFBFBD><D8B1>ļ<EFBFBD>*/
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԵĻ<EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
scanf("%d",&x);
|
|
|
|
|
sum[T]--; /*Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>οջ<CEBF>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>1*/
|
|
|
|
|
computer[T][x]=0; /*Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>״̬<D7B4><CCAC>Ϊ0*/
|
|
|
|
|
printf("\tԤ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
getchar();
|
|
|
|
|
Menu();
|
|
|
|
|
}
|
|
|
|
|
else /*<2A><>ʱ<EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δԤ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
for(i=T+1;i<6;i++) /*Ѱ<><D1B0><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1>δ<EFBFBD><CEB4>Ԥ<EFBFBD><D4A4><EFBFBD>ĵ<EFBFBD><C4B5>Ժ<EFBFBD>*/
|
|
|
|
|
{ time=9+2*i;
|
|
|
|
|
detail(time); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
if(sum[T]>0) /*<2A><><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD>ṩ<EFBFBD><E1B9A9><EFBFBD>Ž<EFBFBD><C5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d,%d\n",2*i+8,2*i+10);break;
|
|
|
|
|
}
|
|
|
|
|
if(sum[T]>0)
|
|
|
|
|
{
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>?:y/n?");
|
|
|
|
|
scanf("%s",&c);
|
|
|
|
|
getchar();
|
|
|
|
|
if(c=='Y'||c=='y') /*<2A>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>ҪԤ<D2AA><D4A4>*/
|
|
|
|
|
{
|
|
|
|
|
if((fp=fopen("waitlist.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("waitlist<EFBFBD><EFBFBD>number telephonenumber\n");
|
|
|
|
|
for(i=0;!feof(fp);i++)
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%s %s",&wait[i].number,&wait[i].telephonenumber); /*¼<><C2BC>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
|
{ prione(i);} /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>εĵȴ<C4B5><C8B4>б<EFBFBD>*/
|
|
|
|
|
printf("\n\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD>ţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>ʽ:\n");
|
|
|
|
|
if((fp=fopen("waitlist.txt","a"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
scanf("%s %s",wait[i].number,wait[i].telephonenumber); /*¼<><C2BC>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
for(i=0;i<1;i++)
|
|
|
|
|
fwrite(&wait[i],sizeof(struct waitlist),1,fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԵĻ<EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
scanf("%d",&y);
|
|
|
|
|
sum[T]--;
|
|
|
|
|
computer[T][y]=0;
|
|
|
|
|
printf("\tԤ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>,<2C><><EFBFBD>ȴ<EFBFBD>֪ͨ!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(i=T+1;i<6;i++) /*Ѱ<><D1B0><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1>δ<EFBFBD><CEB4>Ԥ<EFBFBD><D4A4><EFBFBD>ĵ<EFBFBD><C4B5>Ժ<EFBFBD>*/
|
|
|
|
|
{ time=9+2*i;
|
|
|
|
|
detail(time); /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
if(sum[T]>0) break;
|
|
|
|
|
else printf("<EFBFBD>ܱ<EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δԤ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>"); /*<2A><><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ʾ<EFBFBD><CABE>Ϣ*/
|
|
|
|
|
}
|
|
|
|
|
Menu();
|
|
|
|
|
}
|
|
|
|
|
//else Menu();
|
|
|
|
|
}
|
|
|
|
|
/*ȡ<><C8A1>Ԥ<EFBFBD><D4A4>*/
|
|
|
|
|
void Cancel()
|
|
|
|
|
{
|
|
|
|
|
int time,number,i;
|
|
|
|
|
printf("<EFBFBD><EFBFBD>(8-20)ʱ<>䷶Χ<E4B7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
if(time<8||time>20)
|
|
|
|
|
{
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD>(8-20)ʱ<>䷶Χ<E4B7B6><CEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD> :");
|
|
|
|
|
scanf("%d",&number);}
|
|
|
|
|
sum[T]++; /*ȡ<><C8A1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>οջ<CEBF>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>1*/
|
|
|
|
|
computer[T][number]=1; /*ȡ<><C8A1>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>״̬<D7B4><CCAC>Ϊ1*/
|
|
|
|
|
//detail(time);
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if((fp=fopen("waitlist.txt","r"))==NULL) /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("\nCannot open file!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(i=0;!feof(fp);i++)
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%s %s",&wait[i].number,&wait[i].telephonenumber);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
|
{
|
|
|
|
|
char str[3];
|
|
|
|
|
itoa(number,str,10); /*<2A><><EFBFBD><EFBFBD>itoa<6F><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>*/
|
|
|
|
|
//printf("\n %s" ,&wait[i].number) ;
|
|
|
|
|
//printf("\n %s" ,&str) ;
|
|
|
|
|
if (strcmp(wait[i].number,str)==0 ) /*<2A>ж<EFBFBD>Ҫȡ<D2AA><C8A1><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ͬ*/
|
|
|
|
|
{
|
|
|
|
|
wait[i]=wait[i+1];
|
|
|
|
|
printf("ȡ<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>%s %s",&wait[i-1].number,&wait[i-1].telephonenumber);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
fp=fopen("waitlist.txt","w");
|
|
|
|
|
for(i=0;i<1;i++)
|
|
|
|
|
fwrite(&wait[i],sizeof(struct waitlist),1,fp); /*<2A><><EFBFBD><EFBFBD>д<EFBFBD><D0B4>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>Ϣ*/
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("\tȡ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
getchar();
|
|
|
|
|
Menu();
|
|
|
|
|
}
|
|
|
|
|
/*<2A>鿴<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>Ϣ*/
|
|
|
|
|
void SearchWaiting()
|
|
|
|
|
{
|
|
|
|
|
int time,i;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD>(8-20)֮<><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
if(time<8||time>20)
|
|
|
|
|
{
|
|
|
|
|
printf("\tʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD>(8-20)֮<><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
scanf("%d",&time);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
;
|
|
|
|
|
if((fp=fopen("waitlist.txt","r"))==NULL) /*<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("\nCannot open file!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ printf("<EFBFBD>ڸ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>:\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;!feof(fp);i++)
|
|
|
|
|
{
|
|
|
|
|
fscanf(fp,"%s %s",&wait[i].number,&wait[i].telephonenumber); /*<2A><><EFBFBD>µȴ<C2B5><C8B4><EFBFBD>Ϣ*/
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<10;i++)
|
|
|
|
|
{ prione(i);}
|
|
|
|
|
Menu();
|
|
|
|
|
}
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
void detail(int time) /*ʵ<>ֲ<EFBFBD><D6B2><EFBFBD>ÿ<EFBFBD><C3BF>ʱ<EFBFBD><CAB1><EFBFBD>οջ<CEBF>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>Ϳջ<CDBF>λ<EFBFBD><CEBB>*/
|
|
|
|
|
{
|
|
|
|
|
int i,j=0,k,s=0;
|
|
|
|
|
int v[30];
|
|
|
|
|
for(i=0;i<20;i++)
|
|
|
|
|
{
|
|
|
|
|
if(computer[T][i]==1)
|
|
|
|
|
{ s++; /*sΪ<73><CEAA><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
|
|
|
|
v[j++]=i; /*<2A><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>λ<EFBFBD><CEBB>*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sum[T]=s;
|
|
|
|
|
printf("\tĿǰ<EFBFBD><EFBFBD><EFBFBD>õĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d̨\n",sum[T]);
|
|
|
|
|
for(k=0;k<j;k++)
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD>õĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\n",v[k]);
|
|
|
|
|
}
|
|
|
|
|
void prione(int i) /*ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4>б<EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t %s\n",wait[i].number);
|
|
|
|
|
}
|
|
|
|
|
|