Write a c++ program that uses a structure to store the following weather data for a particular month: Month Total rainfall High temperature Low temperature Average temperature (calculated) The program will have an array of up to 12 structures (representing one year of data) to hold weather data. The number of months to input will be specified by the user . When the program runs, it will ask the user how many months of data to store, and then the data to enter for each month. (The average temperature will be calculated.) Once the data are entered for the months specified, the program will calculate and display:
Write a c++
- Month
- Total rainfall
- High temperature
- Low temperature
- Average temperature (calculated)
The program will have an array of up to 12 structures (representing one year of data) to hold weather data. The number of months to input will be specified by the user . When the program runs, it will ask the user how many months of data to store, and then the data to enter for each month. (The average temperature will be calculated.) Once the data are entered for the months specified, the program will calculate and display:
- Average monthly rainfall
- Total rainfall for period
- Highest temperature (and month)
- Lowest temperature (and month)
- Average of all monthly average temperatures
Be sure to separate interface and implementation by using a header file.
Input validation
- Only accept a user-specified period of 1 through 12 months.
- Only accept temperatures within the range of -100F and +140F.
Sample output
Your prompts and outputs should look similar to the following:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps