这个程序怎么不能运行?
#include <stdio.h>
#include <conio.h>
int i;
struct ccc
{ char room[2];
char week[2];
}c[2];
struct aaa
{ /*定义一个结构变量*/
char room[10];
char week[10];
char day[10];
char time[10];
}a[100];
struct bbb
{
char name[10],tel[10];}b[100];
book()
{
FILE *fp;
char c='Y';
int j=0; gotoxy(1,17);
fp=fopen("wage.txt", "rd");
while(!feof(fp))
{fread(&a[i],sizeof(struct aaa),1,fp);printf("\n");i++;}
while(c=='Y'||c=='y') /*判断是否继续循环*/
{
printf("\nroom:");
scanf("%s", a[i].room); /*输入姓名*/
printf("week:");
scanf("%s", a[i].week);
printf("day:");
scanf("%s", a[i].day);
printf("time:");
scanf("%s", a[i].time);
bijiao() ;
fclose(fp);
fp=fopen("wage.txt", "a");
if(fwrite(&a[i],sizeof(struct aaa),1,fp)!=1)
printf("\n not ok");
while(1)
{
printf("Continue?<Y/N>");
c=getche();
if(c=='Y'||c=='y')
{fclose(fp);break;}
if(c=='n'||c=='N')
fclose(fp); start();
}
}
fclose(fp);start();
}
bijiao()
{ int j;
for(j=0;j<i;j++)
{
if(strcmp(a[j].room,a[i].room)==0 && strcmp(a[j].week,a[i].week)==0 && strcmp(a[j].day,a[i].day)==0 && strcmp(a[j].time,a[i].time)==0)
{printf("It had be booked this time,press any key to go back!");getch();start();}
}
input();
}
input()
{FILE *fp;
fp=fopen("date.dat","a");
printf("\nname:");
scanf("%s", b[i].name);
printf("tel:");
scanf("%s", b[i].tel);
fwrite(&b[i],sizeof(struct bbb),1,fp);
printf("ok\n");getch(); fclose(fp);
}
start()
{ char q;clrscr();gotoxy(30,5);printf("USE CLASSROOM SYSTEM(1.0)");
gotoxy(20,20);printf("name :ChangZhen");gotoxy(20,22);printf("email:zhen_c@263.net");
gotoxy(25,12);printf("Please press any key to continue......");getch();clrscr();
gotoxy(25,8);printf("1,book 2,search 3,exit");
gotoxy(20,20);printf("I choose:");q=getch();
if(q=='1') goto loop;
if(q=='2') search();
if(q=='3') exit(0);
loop : clrscr();gotoxy(2,2);printf("There are 5 classrooms you can book,them are 101,102,103,104 and 105!");
gotoxy(2,3);printf("1=101,2=102,3=103,4=104,5=105");
gotoxy(2,5);printf("There are 18 weeks you can book,them are 1,2,3..........18.");
gotoxy(2,7);printf("There are 7 days in a week you can book,them are Mon,Tue,Wed......Sun.");
gotoxy(2,8);printf("1=Mon,2=Tue......7=Sun");
gotoxy(2,10);printf("There are 5 times in a day you can book,them are :");
gotoxy(2,11);printf("1= 8 :00--10:00");
gotoxy(2,12);printf("2= 10:00--12:00");
gotoxy(2,13);printf("3= 14:00--16:00");
gotoxy(2,14);printf("4= 16:00--18:00");
gotoxy(2,15);printf("5= 19:00--21:00");
gotoxy(2,17);printf("OK! Now, let us go!And press ENTER to OK!");
getch();gotoxy(1,17); book();
}
search()
{int f,g,o,p,k,i=0,d,t;
char w[2],r[2];
FILE *fp;
fp=fopen("wage.txt", "rd");
while(!feof(fp))
{fread(&a[i],sizeof(struct aaa),1,fp);printf("\nok");i++;}
clrscr();
printf("\nPlease input week and room!\n");
printf("week:");scanf("%s", c[0].week);
printf("room:");scanf("%s", c[0].room);
gotoxy(27,5);printf("Mon Tue Wed Thu Fri Sat Sun");
gotoxy(14,6);printf(" 8:00-10:00");gotoxy(14,7);printf("10:00-12:00");gotoxy(14,8);printf("14:00-16:00");
gotoxy(14,9);printf("16:00-18:00");gotoxy(14,10);printf("19:00-21:00");
for (k=0;k<i;k++)
{if (strcmp(a[k].week,c[0].week)==0 && strcmp(a[k].room,c[0].room)==0)
{ strcpy(w,a[k].day);
o=w[0]-48;
strcpy(r,a[k].time);
p=r[0]-48;
f=23+o*5; g=5+p; gotoxy(f,g); printf("*\n");
}
} gotoxy(25,12); printf("Press any key to go back!");
getch(); start();
}
main()
{start();}