这个也是接着上面的,因为实在太大了,不好意思,谢谢各位了!
void ArriveStation::book_ticket(char number_flight,int amount_ticket,Flight_Line flightline[])
{
ofstream out_stream;
string name , time;
string number_flight_line;
int number_ticket;
for(int index = 0; index < 10; index++)
{
if (flightline[index].number_flight_line != number_flight)
{
if (index != 9)
{
continue;
}
else
{
cout << "错误信息."<< endl;
}
}
else
{
char ans;
if(flightline[index].number_tieckt < amount_tieckt)
{
if (flightline[index].number_tieckt == 0)
{
cout << "已满员."<< endl;
}
else
{
cout << "余票不足."<< endl;
}
cout << "是否要登记排队候补(是/Y/y,否/N/n)";
cin >> ans;
if(ans == 'Y'||ans == 'y')
{
out_stream.open("customer.dat");
cout << "请输入名字:";
cin >> name_customer;
cout << "航班号:";
cin >> number_flight;
cout << "飞行日期:";
cin >> time_fly;
out_stream << name_customer< << number_flight< << time_fly< <
cout << "已经为你办理登记\n";
out_stream.close();
}
}
else
{
cout << "余票的座位号是:";
for (int i = 0; i {
cout < }
cout << endl;
char number_your_seat;
cout << "请输入你的座位号:";
for (int index = 0; index < number_yout_seat; index++)
{
cin >> number_your_seat[index];
}
cout << "请按照座票找好你的座位,祝你旅途愉快!"<< endl;
}
break;
}
}
}
ArriveStation::ArriveStation(string& name)
{
string time;
string number_flight;
StationFrameptr head,listhead;
head = NULL;
ifstream in_stream;
in_stream.open("customer.dat");
if(in_stream.fail())
{
cout << "Input file opening fail\n";
exit(1);
}
while (!in_stream.eof())
{
StationFrameptr temp;
temp = new station_frame;
in_stream >> (temp->name)
>> (temp->number_flight)
>> (temp->time);
temp -> link = head;
head = temp;
}
listhead = head; ///////////////////////// 保存链表头
cout <<"候补名单:"<< endl;
cout <<"客户名称" <
while( head->link != NULL)
{
cout << (head->name)
<< setw(5)
<< (head->number_flight)
<< setw(5)
<< (head->time)
<< endl;
head = head ->link ;
}
in_stream.close();
cout << "查找票额是否符合候补客户的要求"< cout << "请输入退的票的日期和航班号:";
cin >> time
>> number_flight;
check_ticket(listhead,time,number_flight);
}
void ArriveStation::check_ticket(StationFrameptr& head,char time_fly,char n_flight)
{
if ( head == NULL)
{
cout << "错误信息";
}
else
{
while(( head->time != time_fly) && (head->number_flight!= n_flight) && (head->link != NULL))
{
head = head ->link ;
}
if(head ->link != NULL)
{
cout<< (head->name)<< "候补条件符合"< << "为" << (head->name) << "办理订票手续"<< endl;
}
else
{
cout << "询问其他候补的客户"< }
}
}
--------------------next---------------------
阅读(1289) | 评论(0) | 转发(0) |