void firstClass(int f);
void businessClass(int b);
void coachClass(char typeTicket);
int main()
{
char type;
cout<<"Please enter your which class you want to fly. (f=firstClass, b=businessClass, c=coach)";
cin>>type;
cout<<endl;
//bad data check
while (type != 'f' && type != 'F' && type != 'b' && type != 'B'&& type != 'c' && type != 'C' )
{
cout<<"Invalid choice, please enter your which class you want to fly. (f=firstClass, b=businessClass, c=coach)";
cin>>type;
cout<<endl;
}
coachClass(type);
return 0;
}
void coachClass(char typeTicket)
{
int amount;
if (typeTicket == 'c' || typeTicket == 'C')
{
cout<<"Please enter how many tickets you want. "<<endl;
cin>>amount;
cout<<endl;
cout<<"you need to pay $"<<amount*200<<endl;
}
else if (typeTicket == 'b' || typeTicket == 'B')
{
businessClass(typeTicket);
/*cout<<"Please enter how many tickets you want. "<<endl;
cin>>amount;
cout<<endl;
cout<<"you need to pay $"<<amount*250<<endl;
*/
}
else
{
firstClass(typeTicket);
/*
cout<<"Please enter how many tickets you want. "<<endl;
cin>>amount;
cout<<endl;
cout<<"you need to pay $"<<amount*300<<endl;
*/
}
}
void businessClass(int typeTicket)
{
int amount;
cout<<"Please enter how many tickets you want. "<<endl;
cin>>amount;
cout<<endl;
cout<<"you need to pay $"<<amount*250<<endl;
firstClass(typeTicket);
}
void firstClass(int typeTicket)
{
int amount;
cout<<"Please enter how many tickets you want. "<<endl;
cin>>amount;
cout<<endl;
cout<<"you need to pay $"<<amount*300<<endl;
}
timdog345 -1 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.