Write a switch statement that tests the value of the char variable response and performs the following actions:
if response is y , the message Your request is being processed is printed
if response is n , the message Thank you anyway for your consideration is printed
if response is h , the message Sorry, no help is currently available is printed
for any other value of response , the message Invalid entry; please try again is printed
__________________________________________________ ________________
I answered:
switch (response)
{
case 0:
if(response=='y')
cout<< "Your request is being processed"<< endl;
break;
case 1:
if(response=='n')
cout<<" Thank you anyway for your consideration" << endl;
break;
case 2:
if(response=='h')
cout<<"Sorry, no help is currently available" << endl;
break;
case 3:
cout<<"Invalid entry; please try again" << endl;
break;
}
Result: Incorrect !
Message:
You are not displaying anything on the screen for any of the different values of response listed in the instructions.
Remember what keyword to use for any other value of response.
You don't seem to be using your cases properly. Don't forget about quotes.