Rewrite the following if, else if, else statement as a switch statement
1. if (option = = 1)
Cout << “The option was 1”;
Else if (option ==20
Cout << “ The option was 2”;
Else if (option == 3)
Cout << “The option was 3”;
Else if (option == 4)
Cout << “The option was 4”;
Else if (option == 5)
Cout << “The option was 5”;
Answers
Answered by
2
Answer:
switch(option){
case 1: Cout<<"the op...";
break;
case 2:Cout <<"";
break;
case 3: Cout<<"";
break;
case 4: Cout<<"";
break;
case 5: Cout<< "";
break;
default: Cout << " no match found";
}
Similar questions