📄 bookticket.cpp
字号:
//订票系统
#include"flight.h"
void airline::Bookticket()//客户信息登记
{
time_t d;
d=time(NULL);
int booknum;
do
{ cout<<"ticket num: ";
cin>>booknum;
}while(booknum>restTicket);
custom*temp=booked;
while(temp!=NULL&&temp->next!=NULL)
{
temp=temp->next;
}
for(int i=0;i<booknum;i++)
{
if(booked==NULL){booked=new custom;temp=booked;}
else
{
temp->next=new custom;
temp=temp->next;
}
cout<<"customer service information :"<<endl;
cout<<"Name: ";
cin>>temp->name;
cout<<"GRADE (A,B,C): ";
do
{cin>>temp->ID;}
while(temp->ID!='A'&&temp->ID!='a'&&temp->ID!='B'&&temp->ID!='b'
&&temp->ID!='C'&&temp->ID!='c');
cout<<"seat:" ;
cin>>temp->seat;
cout<<endl;
temp->date=ctime(&d);
cout<<"BOOKING TIME: "<<temp->date<<endl;
}
temp->next=NULL;
restTicket=restTicket-booknum;
cout<<"REMAIN:"<<restTicket<<endl;
}
void airline::book_wait()
{
char n;
cout<<"All tickets have been booked. Do you want to be an altemate?(Y/N)"<<endl;
do
{cin>>n;}
while(n!='Y'&&n!='y'&&n!='N'&&n!='n');
if(n=='N'||n=='n')return;
custom*temp=rest;
int booknum;
cout<<"ticket num: ";
cin>>booknum;
while(temp!=NULL&&temp->next!=NULL)
{
temp=temp->next;
}
for(int i=0;i<booknum;i++)
{
if(rest==NULL){rest=new custom;temp=rest;}
else
{
temp->next=new custom;
temp=temp->next;
}
cout<<" ****reserve people****"<<endl;
cout<<"NAME: ";cin>>temp->name;
cout<<"ID: ";cin>>temp->ID;
}
temp->next=NULL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -