Annual Rainfall Report Write a program that displays the name of each month in a
ID: 3610770 • Letter: A
Question
Annual Rainfall Report Write a program that displays the name of each month in a yearand its rainfall amount, sorted in order of rainfall from highestto lowest. The program should use an array of structures, whereeach structure holds the name of a month and its rainfall amount.Use a constructor to set the month names. Make the program modularby calling on different functions to input the rainfall amounts, tosort the data, and to display the data. Annual Rainfall Report Write a program that displays the name of each month in a yearand its rainfall amount, sorted in order of rainfall from highestto lowest. The program should use an array of structures, whereeach structure holds the name of a month and its rainfall amount.Use a constructor to set the month names. Make the program modularby calling on different functions to input the rainfall amounts, tosort the data, and to display the data.Explanation / Answer
#include using namespace std;struct rain_fall{const char * month;double rain;}rf[12];class annual_rpt{private:struct rain_fall rf[12];public:annual_rpt(){memset(rf,0,sizeof(rf));}annual_rpt(struct rain_fall *r){int i;for(i=0;iRelated 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.