Share
Explore BrainMass

C++ random number, max, min, average, difference

Write a program that:
a. Randomly generates the daily temperature (in F) of two cities A and B the month of July. The temperatures are integers in the range [60.. 90] and they are stored in two arrays tA and tB.
b. Calculate the average temperature for the month in each city.
c. How many days was the temperature above the average in each city.
d. How many days, and on which days in the month was the temperature in city A lower than the temperature in city B?
e. How many days, and on which days in the month was the temperature the same in both cities?
f. On which day(s) the difference |tA[i] - tB[i]| was maximum?
Important notes:
 The program should consist of a main function and at least six other functions that solve the above sub-problems.
 All function should be called by main function.
 All results should be printed only by the main function.
 No global variables and global arrays should be declared in the program.]

Program has to be done at the easiest lvl of comprehension possible and the program has to have notes to make it more readable.

Solution Summary

Randomnly generates the daily temperature (in F) of two cities A and B the month of July. The temperatures are integers in the range [60.. 90] and they are stored in two arrays tA and tB. Then calculate average, maximum, minimum, maximum difference, lower, same temperatures

$2.19