In the following function definition, the compiler is not pausing to take the user input 'c'. However the compiler is pausing for taking the customer's name.
void Ticket::populateTckt()
{
char c;
//Customer's name
cout<<"Enter the customer's name:";
getline(cin,custName,'\n');
cin.ignore();
//Choice of sport
X:
cout<<"Choose the customer's choice of Sport:\n"
<<"A: Skiing\n"
<<"B: Snowboarding\n"
<<"C: Tubing\n"
<<"D: Ice Skating"<<endl;
cin.get(c);
cin.ignore();
switch(toupper(c))
{
case 'A': sportChoice="Skiing"; break;
case 'B': sportChoice="Snowboarding";break;
case 'C': sportChoice="Tubing";break;
case 'D': sportChoice="Ice Skating";break;
default:
{
cout<<"Invalid input!"<<endl;
goto X;
}
}
//payment amount
if(c=='a' || c=='A' || c=='b' || c=='B')
paymentAmt=75.0;
else if(c=='c' || c=='C')
paymentAmt=50.0;
else
paymentAmt=60.0;
}
Thank you in advance and sorry if I made a very silly mistake.