Question: /* This program reads a movie rating from 1 to 10 from the user and prints a corresponding word for the rating. Programmer: Your name

/*

This program reads a movie rating from 1 to 10 from the

user and prints a corresponding word for the rating.

Programmer: Your name here

Date: Current date here

*/

#include

#include

using namespace std;

int main(int argc, char *argv[])

{

int rating; // user entered rating

cout << "Enter your movie rating (an integer from 1 to 10): ";

cin >> rating;

cout << " The movie was ";

// Select the appropriate word for the number

switch (rating)

{

case 1 : cout << "Horrible (:<)!";

case 5 : cout << "So So!";

case 10: cout << "Fabulous!";

}

cout << " ";

system("PAUSE");

return EXIT_SUCCESS;

}

Fix the program so that inputs of 1, 5 and 10 work properly.

Change the program back by removing the quotes.

Have the inputs 4, 5 and 6 all give the So So message. Do this without adding another cout statement!

Add cases for the other values, 2, 3, 7, 8 and 9. Use your own ratings for these. Test your program.

Add a case that catches all illegal values and prints an appropriate message. It should print: The movie was not rated properly!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!