这个程序怎么不能运行?

dong1106 2001-12-21 11:59:13
#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();}

...全文
85 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
AttaBoy 2001-12-21
  • 打赏
  • 举报
回复
或者给我你的email

My:bluetea@21cn.com
wolfkingb 2001-12-21
  • 打赏
  • 举报
回复
对不起啊!小虾不会
AttaBoy 2001-12-21
  • 打赏
  • 举报
回复
等下次来,我再给你说吧。
bary1980 2001-12-21
  • 打赏
  • 举报
回复
你的编程习惯太不好,代码风格很落后,没有人会愿意看你这样的代码,希望你能尽快改变自己
mme 2001-12-21
  • 打赏
  • 举报
回复
连说明都没有。哪里出错也不说。真是的
gernal_dn 2001-12-21
  • 打赏
  • 举报
回复
编译、链接还是运行?
结构乱成一团,看着太累。
{}好象都不成对?!
函数最好在文件开始处写个声明原型和注释。
ddky 2001-12-21
  • 打赏
  • 举报
回复
看看
somat 2001-12-21
  • 打赏
  • 举报
回复
干嘛用的????
蓝天 2001-12-21
  • 打赏
  • 举报
回复
start()是什么阿?

69,381

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧