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
What is the correct name for the words Home, Insert, Design, Layout, References, etc. in the ribbon in Word 2016?
larisa86 [58]

Answer:

tabs

Explanation:

Microsoft Word refers to a word processing software application or program developed by Microsoft Inc. to enable its users to type, format and save text-based documents.

The commands which are used in Microsoft Word 2016 are displayed using series of icons that are stored on different tabs.

A ribbon is a combination of icons and tabs. In Microsoft Word 2016, the correct name for the words Home, Insert, Design, Layout, References, View, Mailings, and Review in the ribbon is tabs.

Tabs are a section of the Microsoft Word application that avails end users the opportunity to perform certain tasks such as formatting a text, changing the layout, clipboard, paragraph, styles, tables, page setup, inserting a theme, applying color, editing and inputting footnotes, header, citation and bibliography, etc.

8 0
3 years ago
An ftp ____ is a computer that allows users to upload and/or download files using ftp.
Brums [2.3K]
<span>An ftp server is a computer that allows users to upload and/or download files using ftp.</span>
7 0
3 years ago
If you have cable internet service, what protocol is used between the head end connection and the cable company's network
julsineya [31]
The answer would be (DOCSIS). :)

Have a blessed day and hope this helps!
7 0
3 years ago
The refresh or reload button is in the browser toolbar and usually looks like a pair of curved arrows. Clicking it will ________
docker41 [41]

Your answer would be

D. Restart the downloading process

5 0
3 years ago
Read 2 more answers
The difference between Return key and word Wrap
saveliy_v [14]
The enter key is used when we want to go directly to the next line while writing whereas through word wrap the cursor automatically shifts to the next line when the word limit for a particular line is exceeded
3 0
2 years ago
Other questions:
  • A cpu with an external clock speed of 2 ghz and a 64-bit data bus can (theoretically) transfer how much data per second?
    8·1 answer
  • Let's say you're creating a search stream in your hootsuite dashboard, to find mentions of the phrase vacation holiday getaway.
    15·1 answer
  • What is the recommended secure protocol for voice and video applications? secure real-time transport protocol (srtp) hypertext t
    9·1 answer
  • 3. Before you get ready to go diving, you want to explore the area. You see a small snowpack across a small bridge, a short walk
    11·1 answer
  • the technique of blocking some parts of a photograph to emphasize (or draw attention to) another part of the same photograph is
    8·1 answer
  • It is possible to limit the search results to a range of publication dates.
    13·1 answer
  • Users of an access point share the transmission capacity of the access point. The throughput a user gets is called the ________.
    11·1 answer
  • I nees the meaning of these words even just one of them would help out ( pixel megapixel colour depth bit and byte)
    15·2 answers
  • Importance of type casting in programming ​
    5·1 answer
  • For her presentation on Italy, Matilda used a red background with light green text. When her friend critiqued her presentation,
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!