Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> using namespace std; int main() { int guess; cout << \"Pick

ID: 3768984 • Letter: #

Question

#include <iostream>

using namespace std;

int main()

{

int guess;

cout << "Pick a number 0..3: ";

cin >> guess;

switch (guess)

{

case 0:

case 1: cout << "Too low"; // Two case statements execute the same code

break;

case 2: cout << "Right on";

break;

case 3: cout << "Too high";

break;

default: cout << "Illegal input"; // A default case has been added

}

cout << endl;

return 0;

}

Another one that is giving me a headache, cannot seem to get this working correctly, cannot use regular assembler has to be in Pep/8 style.

Explanation / Answer

//This program works properly.I have tested it.I have made small modification by including conio.h library and //getch function ,so that you can see the output.use visual c++ compiler

#include <iostream>
#include<conio.h>
using namespace std;
int main()
{
int guess;
cout << "Pick a number 0..3: ";
cin >> guess;
switch (guess)
{
case 0:
case 1: cout << "Too low"; // Two case statements execute the same code
break;
case 2: cout << "Right on";
break;
case 3: cout << "Too high";
break;
default: cout << "Illegal input"; // A default case has been added
}
cout << endl;
getch();
return 0;
}