Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Processing Temperature Readings from a File C++ temperature.dat 56 57 58 59 59 60 61 62 63 64 65 67 68 69 70 69 68
Processing Temperature Readings from a File C++
temperature.dat
56 57 58 59 59 60 61 62 63 64 65 67 68 69 70 69 68 68 67 66 67 66 64 62 61 61 61 60 60 60 60 61 62 62 63 64 65 67 69 70 71 72 73 72 70 68 66 65 64 63 64 64 64 64 64 63 63 62 62 63 64 66 68 71 71 72 72 71 71 70 68 67 66 66 66 65 65 64 64 64 65 65 66 67 68 68 70 72 73 74 73 72 70 68 67 65 64 64 63 63 62 61 62 63 63 62 63 64 65 66 68 68 69 69 70 69 70 69 68 67 67 66 65 64 63 63 63 62 61 62 63 64 65 65 65 66 67 67 67 66 66 65 65 65 64 63 63 63 63 62 61 60 61 62 63 64 65 66 67 69 70 72 73 72 71 71 70 68Write a C++ program which reads data from a file and processes it as listed in the Requirements Download the file "Data file for assignment 9" from Blackboard to your account in the lab and save it with the filename temperature.dat. This file contains a week of hourly temperature data with one line for each of the 7 days, where each line contains 24 integers (separated by spaces) which are the temperatures in Fahrenheit for each hour of the day. This is a text file and you can open it and view the data Requirements: Name your source file program9.cpp . Make an array with the definition: double celcius [7] [24] Read in the data from the file temperature.dat, convert each value to celcius, and save the celcius temperatures in this array Write a function with the following prototype: void show warmer(double temperature [] [24], int days, double cutoff); This function takes a parameter temperature which is a two-dimensional array of some num ber of days, of 24 hours each. The second parameter days is the number of days for which to access the array temperature. The third parameter cutoff is a value which elements of temperature are compared to in looking for values which are larger. This function needs to print out the values which it finds in the format of the example below (e.g. the output line "At day 2, hour 19, the temperature was 22.78 C.") Prompt the user to enter a value, and then call the function show warmer ) using the value entered by the user for the cutoff parameter. (The prompts and layout must look like the example below.) Write a function with the following prototype: double find_average (double temperature [] [24], int days); This function takes a parameter temperature which is a two-dimensional array of some num- ber of days, of 24 hours each. The second parameter days is the number of days for which to access the array temperature. This function needs to find and return the average of all the values in temperature. It must not print anything on the screen
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started