Complete the following Self-Test exercises (each program should allow the user to enter the data being tested as often as the user wishes) In addition to displaying the output, provide a brief explanation as to how the computer arrived at that output.
What output will be produced by the following code, when embedded in a complete program?
int first_choice = 1;
switch (first_choice + 1)
{
case 1:
cout << "Roast beef\n";
break;
case 2:
cout << "Roast worms\n";
break;
case 3:
cout << "Chocolate ice cream\n";
case 4:
cout << "Onion ice cream\n";
break;
default:
cout << "Bon appetit!\n";
}
#include <iostream> using namespace std; int main() { int first_choice = 1; switch (first_choice + 1) { case 1: cout << "Roast beef\n"; break; case 2: cout << "Roast worms\n"; break; case 3: cout << "Chocolate ice cream\n"; case 4: cout << "Onion ice cream\n"; break; default: cout << "Bon appetit!\n"; } return 0; }
Get Answers For Free
Most questions answered within 1 hours.