
#include #include #include int shoudsave=0 ; int count1=0,count2=0,mark=0,mark1=0 ; /*定义存储火车信息的结构体*/ struct train { char num[10];/*列车号*/ char city[10];/*目的城市*/ char takeoffTime[10];/*发车时间*/ char receiveTime[10];/*到达时间*/ int price;/*票价*/ int bookNum ;/*票数*/ }; /*订票人的信息*/ struct man { char num[10];/*ID*/ char name[10];/*姓名*/ int bookNum ;/*需求的票数*/ }; /*定义火车信息链表的结点结构*/ typedef struct node { struct train data ; struct node * next ; }Node,*Link ; /*定义订票人链表的结点结构*/ typedef struct people { struct man data ; struct people*next ; }bookMan,*bookManLink ; /* 初始界面*/ void printInterface() { puts("********************************************************"); puts("* Welcome to use the system of booking tickets *"); puts("********************************************************"); puts("* You can choose the operation: *"); puts("* 1:Insert a train information *"); puts("* 2:Inquire a train information *"); puts("* 3:Book a train ticket *"); puts("* 4:Update the train information *"); puts("* 5:Advice to you about the train *"); puts("* 6:save information to file *"); puts("* 7:quit the system *"); puts("********************************************************"); } /*添加一个火车信息*/ void InsertTraininfo(Link linkhead) { struct node *p,*r,*s ; char num[10]; r = linkhead ; s = linkhead->next ; while(r->next!=NULL) r=r->next ; while(1) { printf("please input the number of the train(0-return)"); scanf("%s r=p ; shoudsave = 1 ; } } /*打印火车票信息*/ void printTrainInfo(struct node*p) { puts("\ The following is the record you want:"); printf(">>number of train: %s\ rintf("Input your id: "); scanf("%s ; fp=fopen("c:\\\rain.txt InsertTraininfo(l);break ; case 2 : QueryTrain(l);break ; case 3 : BookTicket(l,k);break ; case 4 : UpdateInfo(l);break ; case 5 : AdvicedTrains(l);break ; case 6 : SaveTrainInfo(l);SaveBookmanInfo(k);break ; case 7 : return 0; } printf("\ please press any key to continue......."); getch(); } return 0; }
