Problem

In this exercise, you will experiment with the switch statement. a. Follow the instruc...

In this exercise, you will experiment with the switch statement.

a. Follow the instructions for starting C++ and viewing the Advanced20.cpp file, which is contained in either the Cpp7\Chap06\Advanced20 Project folder or the Cpp7\ Chap06 folder. (Depending on your C++ development tool, you may need to open this exercise’s project/solution file first.) If necessary, delete the two forward slashes that appear before the system("pause"); statement, and then save the program. The program uses the switch statement to display the names of the gifts mentioned in the song “The Twelve Days of Christmas.”

b. Run the program. When you are prompted to enter the day, type the number 1 and press Enter. The names of the gifts for the first through the twelfth days appear on the screen. Stop the program.

c. Run the program again. When you are prompted to enter the day, type the number 9 and press Enter. The names of the gifts for the ninth through the twelfth days appear on the screen. Stop the program.

d. Modify the program so that it displays only the name of the gift corresponding to the day entered by the user. For example, when the user enters the number 4, the program should display the “4 calling birds” message only.

e. Save and then run the program. When you are prompted to enter the day, type the number 4 and press Enter. The “4 calling birds” message should appear on the screen. Stop the program, and then test it using the numbers 1 and 9.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6