You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jifangjiweiyuding/机房机位预订系统003.cpp

254 lines
5.1 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define C 20 //<2F><><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>
#define T (time-8)/2 //Ԥ<><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ηֳɰ<D6B3><C9B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void JIEMIAN();
void XINXI();
void YUDING();
void QUXIAO();
void CHAXUN();
void slove(int time);
void dengdai(int i);
int x[6]={0};
int jiwei[6][20]={
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1},
{1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0},
{1,0,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,1,1,0},
{1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1},
{1,1,0,1,1,1,0,1,0,1,0,1,0,1,1,0,0,0,0,0}};//<2F><><EFBFBD><EFBFBD><30>ջ<EFBFBD>λ<EFBFBD><CEBB><31>л<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ij<EFBFBD><C4B3>ij<EFBFBD>β<EFBFBD>ѯϵͳʱ<CDB3>Ļ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
struct wait{
char number[3];
char haoma[20];
}w[C];//<2F>ȴ<EFBFBD><C8B4>Ľṹ<C4BD><E1B9B9>
6 years ago
6 years ago
int main(void)
{
JIEMIAN();
return 0;
6 years ago
}
6 years ago
void JIEMIAN()
{
int n,a;
do
{
printf("\t\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><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");
puts("\t\t <20><><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><CBB5><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>");
puts("\t\t\t 1.<2E><>ѯijʱ<C4B3><CAB1><EFBFBD>λ<EFBFBD>λ<EFBFBD><CEBB>Ϣ.");
6 years ago
puts("\t\t\t 2.Ԥ<><D4A4>һ<EFBFBD><D2BB><EFBFBD>ջ<EFBFBD>λ.");
6 years ago
puts("\t\t\t 3.<2E><>ѯ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD>Ϣ.");
puts("\t\t\t 4.ȡ<><C8A1>Ԥ<EFBFBD><D4A4>.");
6 years ago
puts("\t\t\t 5.<2E>˳<EFBFBD>ϵͳ.");
puts("\t\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><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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
6 years ago
printf("\t*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>ڵ<EFBFBD>1-5<><35>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD>:\n");
6 years ago
scanf("%d",&n);
if(n<1||n>5)
{
a=1;
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>.\n");
6 years ago
getchar();
}
else
a=0;
}while(a==1);
switch(n)
{
case 1:XINXI();break;
case 2:YUDING();break;
6 years ago
case 3:CHAXUN();break;
case 4:QUXIAO();break;
6 years ago
case 5:exit(0);break;
}
}
void XINXI()
{
int time;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8-20<32><30><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>:");
scanf("%d",&time);
if(time<8||time>=20)
{
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʱ<EFBFBD><CAB1>!");
XINXI();
}
if(time>=8&&time<20)
6 years ago
{
6 years ago
slove (time);
6 years ago
JIEMIAN();
}
6 years ago
}
void YUDING()
{
6 years ago
int time,i,a,b,j;
6 years ago
char c;
FILE *fp; //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8-20<32><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
6 years ago
scanf("%d",&time);
if(time<8||time>=20)
{
printf(" ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʱ<EFBFBD><CAB1>!\n");
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8-20<32><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
6 years ago
scanf("%d",&time);
}
slove(time);
i=0;
if(x[T]>0)
{
if((fp=fopen("ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","a"))==NULL)
{
printf("-<2D>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!-\n");
exit(0);
}
6 years ago
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<D2AA><D4A4><EFBFBD>Ļ<EFBFBD>λ<EFBFBD>ź͵绰(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ź͵绰֮<E7BBB0><D6AE><EFBFBD><EFBFBD>ʹ<EFBFBD>ÿո<C3BF>)<29><>");
6 years ago
scanf("%s %s",w[i].number,w[i].haoma);
for(i=0;i<1;i++)
fwrite(&w[i],sizeof(struct wait),1,fp);
fclose(fp); //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>嵥Ԫ<E5B5A5><D4AA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
6 years ago
printf("\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<D2AA><D4A4><EFBFBD>Ļ<EFBFBD>λ!(<28><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>Ԥ<EFBFBD><D4A4>ʧ<EFBFBD>ܣ<EFBFBD>)<29><><EFBFBD><EFBFBD>\n");
6 years ago
scanf("%d",&a);
getchar();
x[T]--;
jiwei[T][a-1]=1;
printf(" <20><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
JIEMIAN();
}
else
{
6 years ago
printf("\n\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>û<EFBFBD>б<EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD>ĵ<EFBFBD><C4B5>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD>\n");
6 years ago
for(i=T+1;i<6;i++)
{
time=9+2*i;
slove(time);
if(x[T]>0)
printf("\t <20><><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>е<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ǣ<EFBFBD>%d\n",2*i+8);
break;
}
6 years ago
printf("\t <20><><EFBFBD><EFBFBD>ҪԤ<D2AA><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>y/n<><6E>ʾ<EFBFBD>Ƿ<EFBFBD>Ԥ<EFBFBD><D4A4>)\n");
6 years ago
scanf("%s",&c);
getchar();
if(c=='Y'||c=='y')
{
if((fp=fopen("ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r"))==NULL)
{
printf("-<2D>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!-\n");
exit(0);
}
else
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵȴ<EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E7BBB0><EFBFBD><EFBFBD>\n");
6 years ago
for(j=0;!feof(fp);j++)
6 years ago
{
6 years ago
fscanf(fp,"%s %s",&w[j].number,&w[j].haoma);
6 years ago
}
fclose;
}
6 years ago
for(j=0;j<10;j++)
6 years ago
{
6 years ago
dengdai(j);
6 years ago
}
6 years ago
printf("\n\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD>Ļ<EFBFBD>λ<EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
6 years ago
if((fp=fopen("ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","a"))==NULL)
6 years ago
{
6 years ago
printf("-<2D>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!-\n");
exit(0);
6 years ago
}
scanf("%s %s",w[j].number,w[j].haoma);
for(j=0;j<1;j++)
fwrite(&w[j],sizeof(struct wait),1,fp);
fclose(fp);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪԤ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>λ<EFBFBD>ţ<EFBFBD>\n");
6 years ago
scanf("%d",&b);
x[T]--;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ
jiwei[T][b]=1;
printf("\t <20><>ϲ<EFBFBD><CFB2>Ԥ<EFBFBD><D4A4><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><E3BDAB><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>\n");
JIEMIAN();
}
else JIEMIAN();
}
}
void QUXIAO()
{
int time,n;
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8-20<32><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>\n");
6 years ago
scanf("%d",&time);
if(time<8||time>=20)
{
printf(" ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʱ<EFBFBD><CAB1>!");
scanf("%d",&time);
}
if(time>=8&&time<20)
{
printf("\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD>Ļ<EFBFBD><C4BB>ţ<EFBFBD>\n");
scanf("%d",&n);
}
x[T]++;
jiwei[T][n-1]=0;
slove(time);
printf("\t ȡ<><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>\n");
JIEMIAN();
}
void CHAXUN()
{
int time,i;
FILE *fp;
6 years ago
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ҵ<EFBFBD>ʱ<EFBFBD><CAB1>(8-20<32><30>)<29><>\n");
6 years ago
scanf("%d",&time);
if(time<8||time>=20)
{
printf(" ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ʱ<EFBFBD><CAB1>!");
scanf("%d",&time);
}
if(time>=8&&time<20)
{
if((fp=fopen("ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.txt","r"))==NULL)
{
6 years ago
printf("-<2D>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>!-\n");
6 years ago
exit(0);
}
else
{
for(i=0;!feof(fp);i++)
{
fscanf(fp,"%s %s",&w[i].number,&w[i].haoma);
}
fclose;
}
for(i=0;i<10;i++)
{
dengdai(i);
}
JIEMIAN();
}
}
void dengdai(int i)
{
6 years ago
printf("\t\t %s %s \n",w[i].number,w[i].haoma);
6 years ago
}
void slove(int time) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ʱ<EFBFBD><CAB1><EFBFBD>εĿջ<C4BF><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
{
int i,j=0,k,l=0;
int a[50];
for(i=0;i<20;i++)
{
if(jiwei[T][i]==0)
{
l++;
a[j++]=i;
}
}
x[T]=l;
printf("\t Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF>õĵ<C3B5><C4B5><EFBFBD>̨<EFBFBD><CCA8>Ϊ<EFBFBD><CEAA>%d\n",x[T]);
for(k=0;k<j;k++)
{
printf("\t <20><><EFBFBD>õĵ<C3B5><C4B5><EFBFBD><EFBFBD>ǣ<EFBFBD>%d <20><>\n",a[k]+1);
}
}