60.4k views
5 votes
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.

User JMP
by
5.7k points

1 Answer

3 votes

// Here is the required switch statement on response character

switch(response){

case 'y': // case to check if the response is y

cout<<" Your request is being processed ";

case 'n': // case to check for n

cout<<" Than you, anyway for your consideration";

case 'h': // case to check for h

cout<<"Sorry \, no help is currently available.";

default : // default case

cout<< Invalid entry: please try again.";

}

User NullUser
by
5.3k points