void FlightInsert; //增加路线 void FlightDelete;//删除路线 void FlightLookup;//航班查询 void FlightRework;//航班路线修改 void FlightBuyticket;//买票
void FlightCancelticket;//取消订票 void Flightclean;//清空 void MainMenu;//主函数 void Display;//显示订票信息
typedef struct Customer //已定票乘客信息 {
char Name10; //姓名 int Amount; //定票数 int Level; //舱位等级 int SeatNum; //座位号
char FlightNum10; //所定航班号 struct Customer next;
}Customer;
typedef struct Replace //侯补乘客信息 {
char Name10; //姓名e int Amount; //定票数 int Level; //舱位等级
char FlightNum10; //所定航班号 struct Replace next;
}Replace;
typedef struct Flight //航班路线信息 {
char From10; //起点站名 char Des10; //终点站名 char FlightNum10; //航班号 char PlaneNum10; //航班 char Week20; //飞机周日 int Ration; //乘员定额 int FreeTicket; //剩余票数 float Price3; //票价
int ReplacePas; //候补乘客数
Replace ReplName; //该航班的候补乘客名单 Customer CustName; //该航班的已定票乘客名单 struct Flight next; //指示下一航班路线结点
}Flight;PFlight;
int Ration=0; //乘客总数
Flight head; //建立航班路线头结点 Flight rear; //建立航班路尾结点 Customer Cusrear; Replace Reprear; void MainMenu { int i=0; while i=8 { cout< \"< \"< \"< FlightInsert; 提示:当 break; //增加航班路线 case 2: FlightLookup; break; //查询航班路线 case 3: FlightRework; break; //修改航班路线 case 4: FlightBuyticket; break; //预订飞机票 case 5: FlightCancelticket; break; //退订飞机票 case 6: Flightclean; break; //清空系统 case 7: Display; break; case 8:;break; default: cout<<\"提示:抱歉;请选择正确的操作\"< } } cout< /int i=2; whilei=1 {/ Flight p; p=new Flight; cout<<\"正在设定新的路线\"< cout<<\"2.请设定终点站名:\"< cout<<\"3.请设定航班号:\"< cout<<\"4.请设定飞机号:\"< cout<<\"5.请设定飞行周日:\"< cout<<\"6.请设定乘员定额:\"< p->FreeTicket=p->Ration; cout<<\"7.请设定一等舱的价格:\"< cout<<\"8.请设定二等舱的价格:\"< cout<<\"9.请设定三等舱的价格:\"< p->ReplName=new Replace; p->CustName=new Customer; p->CustName->next=NULL; p->ReplName->next=NULL; p->ReplacePas=0; rear->next=p; rear=p; rear->next=NULL; cout<<\"设置成功\"< }/ cout< void FlightLookup //查询航班号 { Flight p;q; char FlightNum10; p=head; int i=0; while i=1 { cout<<\"请输入需要查询的航班号:\"< while p->next && strcmpp->next->FlightNum;FlightNum { } q=p->next; if q==NULL { p=p->next; cout<<\"提示:对不起;不存在此航班号;请核实您的信息 \"< cout<<\" 9.一等舱的价格: \"< cout<<\" 11.三等舱的价格: \"< cout<<\"\"< } } cout<<\"您还需要其他的操作么 \"< cout<<\"\"< int Customer_Number ; Flight p;q; char FlightNum10; int i=0; int a=1; p=head; cout<<\"请输入需要修改的航班:\"< while p->next&&strcmpp->next->FlightNum;FlightNum { p=p->next; } q=p->next; if q==NULL { } else { whilea { cout<<\" 请输入需要修改的数据\"< 1 航班号 \"< \"< 2 飞机号 \"< \"< 3 起始站 \"< \"< 4 目的地 \"< cout<<\" cout<<\" cout<<\" cout<<\" cout<<\" cout<<\" cout<<\" cout<<\" 按5每周出站日期 按 6 成员定额按7一等舱的价格按8二等舱的价格 \"< \"< cin>>q->From;break; cin>>q->Des;break; cout<<\" 按 cout<<\" cout<<\" \"< case 1:cout<<\"1.请输入航班号:\"< case 2:cout<<\"2.请输入飞机号:\"< 退出 cin>>q->Week;break; ; case 7:cout<<\"7.请输入一等舱的价格:\"< cin>>q->Ration;q->FreeTicket=q->Ration-Customer_Number;break cin>>q->Price0;break; case 8:cout<<\"8.请输入二等舱的价格:\"< case 9:cout<<\"9.请输入三等舱的价格:\"< case 10:a=0; break; default:cout<<\"提示:对不起;请选择正确的操作\"< } cout< int Ticket_Amount; void BuyticketPFlight ;int ; void BuyreplacePFlight ;int ;int ; Flight p;q; char Des10; int i=2; while i=1 { cout<<\"请输入目的地:\"< p=head; while p->next&&strcmpp->next->Des;Des { } q=p->next; if q==NULL { } cout<<\"提示:对不起;不存在此航班;请核实您的信息\"< else { whilei=1 { cout<<\"请输入需要购买的票数:\"< whileTicket_Amount==0 && Ticket_Amount<0 { } if Ticket_Amount<=q->FreeTicket { } else { int n; cout<<\"提示:抱歉剩余票数小于定票数;是否需要列入Buyticketq;Ticket_Amount; cout<<\"提示:对不起;请输入正确的票数\"< 候补名单 按1是 按2否\"< } } } } cin>>n; Buyreplaceq;Ticket_Amount;n; cout< void FlightCancelticket //退票 { void BuyticketPFlight ;int ; Flight p;q; Customer h;j; char FlightNum6; char Customer_Name10; int Replace1_Amount; //候补第一个人的定票数 int i; cout<<\"\"< while p->next&&strcmpp->next->FlightNum;FlightNum { } q=p->next; if q==NULL { } else { while i=2 { cout<<\"请输入所查姓名:\"< while h->next&&strcmph->next->Name;Customer_Name { h=h->next; cout<<\"提示:对不起;不存在此航班;请核实您的信息\"< \"< j=h->next; ifj==NULL { cout<<\"提示:对不起;查无此人;请核实您的信息 cout< { //当删除最后一个结点 Cusrear=h; } h->next=h->next->next; q->FreeTicket+=j->Amount; delete j; cout<<\"提示:退票成功\"< if Replace1_Amount<=q->FreeTicket { Replace rep; rep=q->ReplName->next; Customer Cus2; Cus2=new Customer; Cus2->SeatNum=q->Ration-q->FreeTicket+1; strcpyCus2->FlightNum; q->FlightNum ; strcpyCus2->Name; rep->Name ; Cus2->Amount=rep->Amount; Cus2->Level=rep->Level; cout<<\"提示:\"< 买票 \"< 舱;2二等舱;3三等舱\"< cout<<\"No.\"< } cout< q->FreeTicket-=rep->Amount; Cusrear->next=Cus2; Cusrear=Cus2; Cusrear->next=NULL; Cusrear=q->CustName; Cusrear->next=Cus2; Cusrear=Cus2; Cusrear->next=NULL; q->ReplName->next=q->ReplName->next->next; } } q->ReplacePas--; delete rep; } } } } } break; cout<<\"按1返回主菜单;或按任意键返回继续退票操作\"< void Flightclean//清空 { } void BuyticketPFlight q;int Ticket_Amount //买票 { int n=Ticket_Amount; Customer Cus2; Cus2=new Customer; Cus2->SeatNum=q->Ration-q->FreeTicket+1; strcpyCus2->FlightNum; q->FlightNum ; head->next=rear->next; cout<<\"提示:系统已经清空\"< cout<<\"2.请输入购买票的类型:\"< cout<<\"提示:订票成功\"< Cusrear=q->CustName; Cusrear->next=Cus2; Cusrear=Cus2; Cusrear->next=NULL; cout<<\"No.\"< else{ } Cusrear->next=Cus2; Cusrear=Cus2; Cusrear->next=NULL; q->FreeTicket-=Ticket_Amount; } void BuyreplacePFlight q;int Ticket_Amount;int n //进入候补队列 { Replace Rep2; Rep2=new Replace; ifn==1 { q->ReplacePas+=Ticket_Amount; strcpyRep2->FlightNum;q->FlightNum; Rep2->Amount=Ticket_Amount; cout<<\"1.请输入姓名:\"< cout<<\"2.请输入购买票的类型:\"< ifq->ReplName->next==NULL { Reprear=q->ReplName; Reprear->next=Rep2; Reprear=Rep2; Reprear->next=NULL; } else{ Reprear->next=Rep2; Reprear=Rep2; } void Display//显示订票信息 { cout<<\"提示:抱歉;该项目还在开发\"< } Reprear->next=NULL; { } /Customer h;j; char Customer_Name10; int i; while i=2 { cout<<\"请输入所查姓名:\"< while h->next&&strcmph->next->Name;Customer_Name { } j=h->next; ifj==NULL { cout<<\"提示:对不起;查无此人;请核实您的信息h=h->next; break; \"< cout< cout<< //Customer p; //cout<<\"已买票的乘客有:\"< \"< //char FlightNum10; //cout<<\"以下是您所查的车次信息:\"< Cusrear=new Customer; Reprear=new Replace; head=rear=new Flight; head->next=NULL; MainMenu; 因篇幅问题不能全部显示,请点此查看更多更全内容