Question: user is asked to create a program that asks the user to enter a number 1-5 and program will output the name of the number

user is asked to create a program that asks the user to enter a number 1-5 and program will output the name of the number and if the suer enters a number greater than 5 the output will be "invalid input"

include using namespace std; void print(int n) { int num; cout << " Enter a number 1-5 "<< endl; cin >> num; switch(n) { case 1: cout << "One" << endl; break; case 2: cout << "Two"<< endl; break; case 3: cout << "Three"<< endl; break; case 4: cout << "Four"<< endl; break; case 5: cout << "Five"<< endl; break; default:

if ( n>5 ) cout << "Invalid Input"<< endl;

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!