数据结构课程设计
}
cout<<\请输入飞机号:\ cin>>p2->Plane_No; while(1) {
cout<<\请输入飞行周日(1-7):\ cin>>p2->Week_Day;
if(p2->Week_Day<'1'||p2->Week_Day>'7') {
cout<<\数据输入错误,按任意键继续输入.\ getch(); } else break; }
cout<<\请输入乘员定额:\ cin>>p2->Customer_Amount;
cout<<\请输入头等舱票价:\ cin>>p2->Price[0];
cout<<\请输入普通舱票价:\ cin>>p2->Price[1];
cout<<\请输入经济舱票价:\ cin>>p2->Price[2];
p2->Free_Amount=p2->Customer_Amount; //剩余票数与乘员定额相同
21
数据结构课程设计
p2->CustName=NULL; //该航线定票乘客头指针为空
p2->ReplName=NULL; //初始候补名单为空 if(Continue()=='n') {
p2->Next=NULL; //航线的下一结点为空 return; } } }
//------------航线是否为空函数------------- int Empty_Flight() {
if(Head==NULL) {
system(\
cout<<\对不起,没有相关航线。按任意键返回...\ getch(); return 1; } else
return 0; }
//------------航线查看函数-----------------
22
数据结构课程设计
void Line_See() {
int Day; Flight *p1; p1=Head;
char *Week_Day[]={\星期一\星期二\星期三\星期四\星期五\星期六\星期日\
if(Empty_Flight()) //航班线为空 return;
prefix(\航班查看\
cout<<\┌────┬───┬───┬────┬────┬────┬────────┐\
cout<<\│ │ │ │ │ │ │ 票 价 │\
cout<<\│终点站名│航班号│飞机号│飞行周日│乘员定额│剩余票数├──┬──┬──┤\
cout<<\│ │ │ │ │ │ │头舱│普舱│经舱│\
cout<<\├────┼───┼───┼────┼────┼────┼──┼──┼──┤\ while(p1!=NULL) {
Day=p1->Week_Day-'0'-1;//数字转换相应星期数
cout<<\│\│\
23
数据结构课程设计
\│\ \│\\│ \ \
│
│
\\
││
\
\│\ p1=p1->Next; if(p1!=NULL)
cout<<\├────┼───┼───┼────┼────┼────┼──┼──┼──┤\ }
cout<<\└────┴───┴───┴────┴────┴────┴──┴──┴──┘\
cout<<\按任意键返回子菜单...\ getch(); }
void Sub1Menu() {
char *MenuItem[]={\│ 航空客运航线管理子菜单 │\│ │[1]. 航 线 增 设 │ │\
\│ │[2]. 航 线 查 看 │ │\│ │[3]. 返 回 主 菜 单 │ │\ while(1)
switch(ModelMenu(MenuItem,4)) {
case '1':{Line_Add();break;}
24
数据结构课程设计
case '2':{Line_See();break;} case '3':{return;} default:{ErrorMess();} } }
//---------------订票办理函数--------------- void Sub2Menu() {
int Ticket_Count,Seat_No,i,flag=0;
int Flight_No=0; //记录满足条件的航线的定票结点 Flight *p1; //记下满足条件的航线结点地址 Customer *p2; //临时性定票乘员结点 Replace *p3; //临时性候补乘员结点 char answer[7]; //用户输入的航班数据 char temp;
int tag=0; //候补乘客标志位 int Amount;
int IsRepl=0; //是否执行候补操作标志位 if(Empty_Flight()) //航班线为空 return; while(1) {
prefix(\订票办理\
flag=0; //标志位清零以重新作出判断 Flight_No=0;
25