Write a C++ program that reads in the historical average monthly rainfall for NY for each month of the year and then reads in the actual monthly rainfall for each month in 2007. Finally, the program should print out a nicely formatted table showing the average rainfall for each month, the total rainfall for each month of 2007, and how much above or below average the rainfall was for each month. The output should correctly label the months.

Your program should give the user the option of entering all data from the command line or reading the data from directly from two files. Data files for this problem can be downloaded using the following commands:


There are a various ways of dealing with the month names. One straightforward way is to code the months as integers and then do a conversion before doing output. A large switch statement is acceptable in an output function. The month-by-month input for manual data entry can be done any way you like, so long as it is relatively easy and pleasant for the user.

Be sure to make good use of functions in your program. At a minimum, you should include separate functions for each input method and for generating the results. You may also decide to create a function for outputting the month names.

I am a beginner and our teacher gave me this assignment. I am going to be writing some code tonight but I am having a tough time starting. should I have a seperate function to handle both manual and file input parts?

I am a beginner and our teacher gave me this assignment. I am going to be writing some code tonight but I am having a tough time starting. should I have a seperate function to handle both manual and file input parts?

At a minimum, you should include separate functions for each input method and for generating the results

I would say yes from this description. Separate the problem into separate parts and tackle them separately. Tackle the ones you know how to do first, then start researching the rest. Don't just start coding. You need to decide what you need first on paper. It will make life much easier.

Okay thank you, can I post some code here to get some help from it after I start?

Okay thank you, can I post some code here to get some help from it after I start?

Yes, post it. It makes it much easier to help you if we see the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.