Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

ISBN: 0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Describe three other types of visual aids.

Answered: 1 week ago

Question

LO2 Distinguish among three types of performance information.

Answered: 1 week ago