Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language C++ weather.txt: For this lab you will be reading in and analyzing a set of data. The data file is in the file called

Language C++

image text in transcribed

weather.txt:

image text in transcribed

 


For this lab you will be reading in and analyzing a set of data. The data file is in the file called weather.txt. It is provided to you and you need to copy it to wormulon. You should begin by opening the file with nano or another text editor and examining the format - note that it contains the weather (highest and lowest temperature of each day) for Moscow, ID for January 1 to 31, 2016. For this lab you need to write a program to read in the data and do the following calculations using 4 functions (pass array and its size to the functions): Report the highest recorded temperature. Report the lowest recorded temperature. Report the average daily high temperature. Report the average daily low temperature. To read in a data file you need to open the file using the fstream library (#include ). Then you need to create an input file stream object and connect it to the weather file: int x; ifstream infile; //create an ifstream object infile.open("weather.txt"); //open the file, if the weather.txt is located under the same directory with your program, otherwise, path to the file needs to be specified. Then you can read from the file using infile: infile >> x; //read in a single integer from the file Note that the >> symbols are used just as with cin, but now the data is coming from a file rather than the keyboard. infile.close(); //close the file after reading The weather.txt file contains 3 columns of data (if the date is treated as 3 columns). So, you may want to create 3 separate arrays one for each column. Note that the code to read in the data may look something like: for(int i=0; i > array[i]; infile >> array2[i]; infile >> array3[i]; } Make sure the data is stored into arrays correctly, and then work on building the functions.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To solve this problem youll need to read the data from weathertxt file store it in arrays and perform calculations using functions Below is a stepbyst... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago

Question

e. What difficulties did they encounter?

Answered: 1 week ago