全国交通咨询模拟数据结构课程设计
printf("\n请输入城市名称的信息:\n"); while(flag=='y'||flag=='Y') { printf("城市名称:"); gets(city[i]); i++; printf("继续输入?(Y/N)"); scanf("%c",&flag); getchar(); } printf("\n");
if((fp=fopen("city.txt","wb"))==NULL) { printf("无法打开文件!\n"); return; } for(j=0;j<i;j++) fprintf(fp,"%10s",city[j]); fclose(fp); }
void createplanefile() { int code,bt[2],at[2]; float money; int i; int count;
char vt[10],vh[10],flag; FILE *fp; flag='y'; count=0;
while(flag=='Y'||flag=='y') { printf("请输入飞机航班的信息:\n"); printf("飞机航班编号:"); scanf("%d",&code); getchar();
printf("起始城市:"); gets(vt);
printf("目的城市:"); gets(vh);
printf("航班费用:"); scanf("%f",&money); getchar();
printf("起飞时间:");