An amateur meteorologist wants to keep track of weather conditions during the pa
ID: 3633438 • Letter: A
Question
An amateur meteorologist wants to keep track of weather conditions during the past year's three month summerseason and has designated each day as either rainy(R), cloudy (C) or sunny (S). Write a program that stores this information in a 3x30 array of characters, where the row indicates the month (0=june,1=july,2=August) and the column indicates the day of the month. Note that data is not being collected for the 31st of any month. The program should begin by reading the weather data in from a file. Then it should create a report that displays for each month and for the whole 3 month period, how many days were rainy, how many were cloudy, and how many were sunny. It should also report which of the three months had the largest number of rainy days. Data for the program can be found in rainorshine.dat file.
The data file says:
RRCSSSCSCRRRCSSSCSSRSCCRCRRCSS
SSSCCSSSCCSSSCCSSSCRCRCCSSSSSS
SSSSCSSSCSSSCRRCCCSSSSSCSSSSCS
Explanation / Answer
#include #include #include using namespace std; //uses/makes rainorshine.dat void create(); void process(); int main(){ char wait; create();//writes info to file process();//read that file and output info coutwait; return 0; } void create(){ string info="RRCSSSCSCRRRCSSSCSSRSCCRCRRCSS SSSCCSSSCCSSSCCSSSCRCRCCSSSSSS SSSSCSSSCSSSCRRCCCSSSSSCSSSSCS"; ofstream dat; dat.open("rainorshine.dat"); if(dat.is_open()){ coutRelated 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.