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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started