Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ language : Please write a program using switch statements, with the following rules (see hint below the instructions). --------------------------------------------------------------------------------------- The only printf lines

Using C++ language :

Please write a program using switch statements, with the following rules (see hint below the instructions).

---------------------------------------------------------------------------------------

The only printf lines you can use are the following:

(you can only use each one once)

printf("Enter an integer (1-10) "); printf("A"); printf("B"); printf("C"); printf("D"); printf("E"); printf("F");

Ask the user to enter an integer.

Print A if the user enters 3 Print B if the user enters 1,2, or 3 Print C if the user enters 10 Print D if the user enters 5, 6, 7, or 10 Print E if the user enters 4 Don't print anything if the user enters 8 or 9 Print F if the user enters any other number not listed above.

Can follow this syntax format while you build the program

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

switch(expression) { case X: // code block break; case y: // code block break; default: // code block } #include using namespace std; int main() { int num=5; switch(num+2) { case 1: cout using namespace std; int main() { int i=2; switch(i) { case 1: cout using namespace std; int main({ int i=2; switch(i) { case 1: cout

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 Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions