An amateur meteorologist wants to keep track of weather conditions during the past year's three month summer
season 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.
i would like help setting up this program... I am looking for the comments... I don't want you to do it for... or anything like that... I just need to be started off.. we haven't covered this chapter in class yet....
Which chapter would that be? Of course there is nothing wrong with you reading the chapter yourself.
The instructions seem pretty clear to me
Create the starter program with main() function
Add a character array that has 3 rows and 30 columns
Create an iostream object, open the data file and read the rows into the array.
Loop through the character array and, for each month, count the number of R's, S's and C's.
Display the report on the screen using std::cout.
If you don't know how to use ifstream then you can search for example code -- there is lots of it all over the net and even here at DaniWeb. Learn to make google one of your best programming buddies.
Last edited by Ancient Dragon; Apr 20th, 2009 at 11:41 pm.
>>How do i find the month with the largest amount of rain?
You already have the array that contains the count of the number of Rs, Ss and Cs. Now all you have to do is iterate through that array and keep track of which month has the greatest number of Rs. How would you do that? Try it with pencil & paper first
Last edited by Ancient Dragon; Apr 29th, 2009 at 6:06 pm.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.