In this exercise, you will experiment with the switch statement. a. Follow the instructions for starting C++
Question:
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 Cpp8\Chap06\Advanced20 Project folder or the Cpp8\Chap06 folder. (Depending on your C++ development tool, you may need to open this exercise’s project/solution file first.) 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. Close the Command Prompt window.
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. Close the Command Prompt window.
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. Close the Command Prompt window, and then test the program using the numbers 1 and 9.
Step by Step Answer: