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
Is technology science? I mean, I think it is... uh, why am I so paranoid about this project.
STALIN [3.7K]

Answer:

i ..d..k do something ez

Explanation:

5 0
3 years ago
Read 2 more answers
Which control segment communicates with the satellites? OA master stations O B. monitoring stations O C. ground antennas D. cont
nignag [31]

Answer:

C. ground antennas

Explanation:

AKA Satellite Dishes That Communicate Just Like Direct Tv dish It is focused by a bowl-shaped parabolic dish onto a device in the center called a "feed horn", which channels the signal to a "low-noise block down converter" (LNB) which filters out unwanted interference, and sometimes converts it to yet another frequency before amplifying it and sending it to the satellite receiver

5 0
2 years ago
Tim is in charge of the upcoming interschool baketball tournamnent. He wants to arrange all of the teams and their members in al
zalisa [80]
I think the answer is C.
7 0
2 years ago
Explain with a few sentences and using the terms sequencing, selections and loops how they
Sever21 [200]

Answer:

here is your answer

Explanation:

voting is electing people to be ruler

mar me as brainliest

5 0
3 years ago
refers to a problem-solving approach that requires defining the scope of a system, dividing it into its components, and then ide
lilavasa [31]

Answer:

D. System Analysis

Explanation:

System analysis can be defined as the process of analysing a problem in order to the know the cause thereby finding a way to resolve it or finding a solution to it.

System analysis enables us to easily study procedure or process thereby identifying what the objective of the procedures is which will in turn help to achieve what we needed to achieve.

System analysis is important because it enables easier identification of a problem which make us to find the best way to solve the problem since it is a problem solving technique which ensures that all problem are been resolved accurately and efficiently

6 0
3 years ago
Other questions:
  • What are the challenges of photographing at night? Why did the photographer “paint” the waterfall with the flashlight?
    9·1 answer
  • Describe network in terms of the class computer lab
    9·1 answer
  • Write a query to show the price reduced by 10% for all products that are tables or entertainment centers with a standard price g
    10·1 answer
  • What information on social networking sites could be used to discriminate against a potential employee
    9·1 answer
  • 14. Convert 11110111 from binary to denary<br> (1 Point)
    12·2 answers
  • Charlie wants you to include the following topics in your presntation: an overview of project management and its hrity,a descrip
    15·1 answer
  • Which code will allow Joe to print Coding is fun. on the screen? print("Coding is fun.") print(Coding is fun.) print = (Coding i
    10·2 answers
  • Which of the following shows a list of Big-Oh running times in order from slowest to fastest?
    7·2 answers
  • 1. Light of wavelength 900x10-9 m is emitted by a source. What is its frequency?​
    5·1 answer
  • SO I LIKE BOILED EGGS AND MY MUM WAS MAKING SALAD FOR DINNER SO I SAID DID YOU MAKE AND EGG-TRA ONE FOR ME
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!