- void order() /*排序模块*/
- {
- int i,j;
- struct plane s;
- system( "cls" );
- for(i=0;i<n;i++)
- {
- for(j=i+1;j<n;j++)
- if(strcmp(ti[i].data,ti[j].data)>0)
- {s=ti[i];
- ti[i]=ti[j];
- ti[j]=s;}
- }
- printf("The ordered data is:\\n");
- puts("\\n--------------------------------------------------------------------");
- printf("\\n\\t航班大号 起飞地点 降落地点 起飞时间 票价 最大乘客 已售票数\\n");
- for(i=0;i<n;i++)
- {
- printf_one(i);
- printf("\\n");
- }
- getchar();
- getchar();
- menu1();
- }
- void search_time()
- {
- int i,m=0;
- struct plane s;
- system( "cls" );
- printf("\\n\\nEnter the time:");
- scanf("%s",s.data); /*输入出发的时间*/
- puts("\\n--------------------------------------------------------------------");
- printf("\\n\\t航班代号 起飞地点 降落地点 起飞时间 票价 最大乘客 已售票数\\n");
- for(i=0;i<n;i++)
- {
- if(strcmp(s.data,ti[i].data)==0)
- {
- m++;
- if((m!=0)&&(m%10==0)) /*目的是分屏显示*/
- {
- printf("\\n\\nPress any key to contiune . . .");
- getchar();
- puts("\\n\\n");
- }
- printf_one(i);
- printf("\\n");
- /*调用显示一个记录的函数*/
- }
- }
- puts("\\n--------------------------------------------------------------------");
- getchar(); /*按任意健*/
- getchar();
- menu1();
- }
- system( "cls" ); /*清屏*/
- NOD *insert(NOD *head)
- { NOD *temp,*p;
- p=head;
- temp=(NOD *)malloc(sizeof(NOD));
- printf("\\n\\t请输入航班号:");
- scanf("%s",temp->number);
- printf("\\n\\t请输入起点站:");
- scanf("%s",temp->start);
- printf("\\n\\t请输入终点站:");
- scanf("%s",temp->arrive);
- printf("\\n\\t请输入起飞时间:");
- scanf("%s",temp->starttime);
- printf("\\n\\t请输入到达时间:");
- scanf("%s",temp->arrivingtime);
- printf("\\n\\t请输入班期:");
- scanf("%s",temp->date);
- printf("\\n\\t请输入票价:");
- scanf("%s",temp->price);
- printf("\\n\\t请输入航班型号:");
- scanf("%s",temp->model);
- head=temp;
- temp->next=p;
- return head;
- }
- *显示*/
- void display(NOD *head)
- {
- NOD *p;
- p=head;
- while(p!=NULL)
- {
- printf("航班号:%s\\n",p->number);
- printf("起点站:%s\\n",p->start);
- printf("终点站:%s\\n",p->arrive);
- printf("班期:%s\\n",p->date);
- printf("起飞时间:%s\\n",p->starttime);
- printf("到达时间:%s\\n",p->arrivingtime);
- printf("票价:%s\\n",p->price);
- printf("飞机型号:%s\\n",p->model);
- p=p->next;
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/250420149381.html
来源: http://www.codesnippet.cn/detail/250420149381.html