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
zmey [24]
3 years ago
9

Write a program that will input temperatures for consecutive days. The program will store these values into an array and call a

function that will return the average of the temperatures. It will also call a function that will return the highest temperature and a function that will return the lowest temperature. The user will input the number of temperatures to be read. There will be no more than 50 temperatures. Use typedef to declare the array type. The average should be displayed to two decimal places
Computers and Technology
1 answer:
Anna [14]3 years ago
5 0

Answer:

#include <iostream>  

using namespace std;

typedef double* temperatures;

double avg(array t, int length);

double min(array t, int length);

double max(array t, int length);

int main()

{

   cout << "Please input the number of temperatures to be read." << endl;

   int num;

   cin >> num;

   temperatures = new double[num];

   for(int i = 0; i < num; i++)

   {

       cout << "Input temperature " << (i+1) << ":" << endl;

       cin >> temperatures[i];

   }

   cout << "The average temperature is " << avg(temperatures, num) << endl;

   cout << "The highest temperature is " << max(temperatures, num) << endl;

   cout << "The lowest temperature is " << min(temperatures, num) << endl;

}

double avg(array t, int length)

{

   double sum = 0.0;

   for(int i = 0; i < length; i++)

       sum += t[i];

   return sum/length;

}

double min(array t, int length)

{

   if(length == 0)

       return 0;

    double min = t[0];

   for(int i = 1; i < length; i++)

       if(t[i] < min)

           min = t[i];

   return min;

}

double max(array t, int length)

{

   if(length == 0)

       return 0;

      double max = t[0];

   for(int i = 1; i < length; i++)

       if(t[i] > min)

           max = t[i];

   return max;

}

Explanation:

The C++ program get the array of temperatures not more than 50 items and displays the mean, minimum and maximum values of the temperature array.

You might be interested in
What directory under / contains the log files and spools for a linux system?â?
Stells [14]
/home is the default directory
5 0
3 years ago
Water is constantly in motion.<br> True or false
motikmotik

Answer: true

Explanation: yes water is constantly in motion

7 0
3 years ago
Provide examples of the cost of quality based on your own experiences
Phoenix [80]

Answer:

Cost of quality is define as methodology which basically decide the cost of product and services in an organisation and company. It also determine all the cost which are associated with the quality.

The cost of quality basically divided into four categories that are:

  • Appraisal
  • Prevention
  • External failure
  • Internal failure

Example of the cost of quality is that, in oil refinery industry if the growth of product increased then, the company state also increased. In same way, if there is decrease in the refining state of the product then, the growth of product automatically reduced.

3 0
3 years ago
Select all that apply
My name is Ann [436]

Answer:

social change and cultural change i hope this help you

8 0
3 years ago
Kerning is the adjustment of space between ___ characters.
IrinaK [193]
Answer: printed

Explanation: The definition of kerning is; the spacing between letters or characters in a piece of text to be printed.

4 0
4 years ago
Other questions:
  • Several steps are involved in creating a presentation. what is the last step in the process before preparing to presenting it?
    12·1 answer
  • What command will disable dns lookup to prevent the router from attempting to translate incorrectly entered commands as though t
    6·1 answer
  • The memory locations listed in a procedure header's parameterList have procedure scope and are removed from the computer's main
    9·1 answer
  • When a CPU executes instructions as it converts input into output, it does so with
    12·1 answer
  • Word processing software, spreadsheet software, database software, and presentation software are examples of what category of co
    6·1 answer
  • Which might be included in both your speaking outline and your preparation outline? A. Detailed descriptions of each main point
    8·1 answer
  • A potentiometer a three wire variable resistor is used in which type of sensor ?
    13·1 answer
  • Assume a computer uses pipelining of 9 stages. Each stage demands 3 clock cycles to finish its task. How many clock cycles are n
    9·1 answer
  • What are some ways you can work with templates? Check all that apply.
    9·2 answers
  • NEED ANSWERS ASAP
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!