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]
2 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]2 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
1. _____ are used to clarify code, but are not interpreted by the interpreter as commands. (1 point)
mariarad [96]

Answer:

1. D Comments

2. B False

3. C Logical Expression

8 0
3 years ago
Read 2 more answers
Help please im not sure what this means T^T
Vesna [10]

Answer:

14

Explanation:

7 0
3 years ago
Read 2 more answers
The dns clients that make requests to the dns server are known as ____________.
beks73 [17]
<span>The dns clients that make requests to the dns server are known as : </span>Recursive queries

-Hope this helps.
6 0
3 years ago
Read 2 more answers
Materials used in front office
mina [271]

Answer:

A Telephone, Printer, Computers, Security Monitor

4 0
3 years ago
Which of these characteristics is most important to a systems analyst? (1 point) (Points : 1.5) communicator
zvonat [6]

Answer: Problem solver

Explanation:

 Problem solver is the most important characteristics for the system analyst as it important for the organization to control all the problems.

System analysis basically define the problem in the particular organization to be solved and also provide the proper architecture in the system.  

The good and strong problem solving ability makes the organization more efficient in the decision making problem and also improve the overall system analyst in the organization.

7 0
3 years ago
Other questions:
  • You are reluctant to write an extra credit book report because you are afraid that your language and punctuation skills are not
    11·1 answer
  • Why will the standard replacement algorithms (LRU, FIFO, clock) not be effective in handling this workload for a page allocation
    11·1 answer
  • What is the abbreviation used for educational sites/?
    8·1 answer
  • Two electronics students are discussing static electricity and electric current. Student A says that a basic property of static
    12·1 answer
  • Which is a value of the Scrum Manifesto?
    9·1 answer
  • A Network Attached Storage device is good for _____.
    11·2 answers
  • What is the reason of non-deterministic (indeterminate) behavior of concurrent programs?
    9·1 answer
  • Controlling access of information on the internet
    15·1 answer
  • Which statement about muzzleloaders is true? All muzzleloaders are rifles. All muzzleloaders have only one barrel. Muzzleloaders
    12·1 answer
  • Four ways to improve the performance of a hard disk include.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!