Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Please. Design a program to allow a meteorologist to enter the number of inches of rainfall received in the last week for several cities.
C++ Please.
Design a program to allow a meteorologist to enter the number of inches of rainfall received in the last week for several cities. The program should ask the meteorologist how many cities they want to enter data for, allocate an appropriately sized array, and allow them to enter the data. After the data has been entered, the program should print out the average number of rainfall inches across all of the cities. Be sure to clean up the heap before the program ends. Before writing the program, create 3 test cases (with expected output). Put your test cases in comments in the program. After writing the program (lab7_rainfall.cpp), run your test cases and check that they work correctly. You do not need to check user input for validity. Example output (user input is highlighted): Hello Scientists! You need to record the rainfall per city (in inches). How many cities would you like to record the rainfall of: 3 How much rainfall was there in city 0: 6.2 How much rainfall was there in city 1: 1.3 How much rainfall was there in city 2: 2.7 Average rainfall per city: 3.4 inches Is it possible to write this program without using dynamic memory (heap)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