Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 5 : Suppose we have the following lines of code in main ( ) int option; cout < < MENU OF TASKS < <

QUESTION 5:
Suppose we have the following lines of code in main()
int option;
cout <<MENU OF TASKS
<<1. Task 1
<<2. Task 2
<<3. Task 3
<<0. Exit.
;
cout <<Enter a number from 1 to 3 to select a task or 0 to Exit;
cin >> task;
if (task ==1)
{
cout <<You select task 1;
}
else if (task ==2|| task ==3)
{
cout <<You select task 2 and task 3);
}
else if (task ==0)
{
cout <<Your select EXIT.;
}
else
{
cout <<Invalid task;
}
Question: Convert the above if..else..if STATEMENT into a SWITCH STATEMENT

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Distinguish actual costing from normal costing

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago