1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DENIUS [597]
3 years ago
14

How to write a C++ program that allows a user to enter their rating of the three movies in the Dark Knight Trilogy and then disp

lay each rating entered, the highest rating, the lowest rating, and the average of the ratings??
Computers and Technology
1 answer:
8_murik_8 [283]3 years ago
8 0

The program is an illustration of arrays.

Arrays are used to hold multiple values in one variable.

The program in C++ where comments are used to explain each line is as follows:

#include <iostream>

using namespace std;

int main(){

   //This declares an array of three elements for the three ratings

   int ratings[3];

   //This initializes the sum of the ratings to 0

   int total = 0;

   //The following iteration gets input for the three ratings

   for(int i = 0; i<3;i++){

       cin>>ratings[i];

       //This calculates the sum of all inputs

       total+=ratings[i];

   }

   //This declares and initializes the lowest and the highest ratings

   int lowest = ratings[0], highest = ratings[0];

   //This iterates through the array

   for(int i = 1; i<3;i++){

       //The following if condition determines the lowest rating

       if (lowest > ratings[i]){    lowest = ratings[i];        }

       //The following if condition determines the highest rating

       if (highest < ratings[i]){            highest = ratings[i];        }

   }

   //This prints the output header

   cout<<"The ratings are: ";

   //The following iteration prints the three ratings

   for(int i = 0; i<3;i++){

       cout<<ratings[i]<<" ";   }

   //The prints the highest ratings

cout<<endl<<"Highest: "<<highest<<endl;

   //The prints the lowest rating

   cout<<"Lowest: "<<lowest<<endl;

   //The prints the average rating

cout<<"Average: "<<total/3<<endl;

   return 0;

}

At the end of the program, the ratings entered, the highest rating, the lowest rating, and the average of the ratings are printed.

See attachment for sample run

Read more about similar programs at:

brainly.com/question/13261254

You might be interested in
What is the full form of GDP
Andrej [43]

Answer:

gross domestic product

Explanation:

there are 4 different types, I don't know if that was what you were looking for but

I hope it helped :)

5 0
3 years ago
PLEASE HELP!!!!!!!!!!!! IT'S VERY URGENT!!!!!!!!! Social Networks websites put the responsibility for intellectual property?
Tasya [4]
I think all the answers you picked were correct except the last one I think is B because even though the disc is copyrighted it's not considered intellectual property
7 0
3 years ago
Read 2 more answers
Which system provides an easier way for people to communicate with a computer than a graphical user interface (GUI)
Marta_Voda [28]
Answer: natural Language Processing

Explanation:

Natural Language Processing: It is a sub field of linguistics which is concerned with the interactions between Human and computer especially how to program computers to process and to understand large amounts of natural language data.
6 0
3 years ago
How should a common data source, like social media comments, be categorized
Masja [62]

Answer:

unstructured data

Explanation:

Sources that are likely to give you unstructured data might be: Social media posts

4 0
2 years ago
What does "&amp;&amp;" mean?
Leviafan [203]

Answer:

And

Explanation:

& is a simplified version of and

3 0
3 years ago
Read 2 more answers
Other questions:
  • A search engine displays a list of webpage names that contain the search text. what is the term for that list?
    14·1 answer
  • How do you represent a 3D object with unusual curves in 2D space? CAN SOMEONE HELP PLEASE
    12·1 answer
  • What cable should i be using to connect my android tablet to the pc?
    13·2 answers
  • How can the output of a command be redirected to a file instead of being displayed on the computer's screen?
    9·1 answer
  • Write a C program to compute the average age of nth student
    13·1 answer
  • __________ is the process by which previously distinct technologies come to share tasks and resources.
    10·1 answer
  • Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
    12·1 answer
  • write up a performance review for a fellow employee. Imagine you work in a shop and this is a fellow salesperson on the shop flo
    9·1 answer
  • In the range D5:D9 on all five worksheets, Gilberto wants to project next year's sales for each accessory, rounded up to zero de
    6·1 answer
  • How can you change the block input so that the sprite moves in the opposite direction?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!