Temperature measurements are done in a room in five different locations during a
ID: 3626451 • Letter: T
Question
Temperature measurements are done in a room in five different locations during a week (seven days) once a day. Write a program that first reads the five temperature values measured in the first day. After that the program reads the next five temperature values measured in the second day and so on. When all the measured values are entered the program finds the location where the average temperature during the week (the average value of temperatures during seven days) has been lowest. It is enough to display the location number on the screen (1, 2, 3, 4 or 5).Explanation / Answer
#include #include using namespace std; void getInput(double location[][5]); //obtains the input and puts the information into a multidimensional array void calculateAverages(double location[][5], double averages[]); //calculates the average for each location int calculateLowest(double averages[]); //determines which location had the lowest average temperature int main(int argc, char *argv[]) { double location[7][5], averages[5]; int lowest_location; getInput(location); calculateAverages(location, averages); lowest_location = calculateLowest(averages); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.