67 224
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #23969 in C++ for Nourh

Question #23969
11. Suppose I have a variable called num whose value has already been set. Write a switch statement that will print "One" if the value of num is 1, "Two" if the value of num is 2, and "Three" if the value of num is 3.
Expert's answer
#include <iostream>
#include <conio.h>


using namespace std;

int main()
{
int number;
cout<<"Enter number (1,2 or 3): ";
cin>>number;
switch(number){
case 1:
cout<<"One";
break;
case 2:
cout<<"Two";
break;
case 3:
cout<<"Three";
break;
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions