You need to do these after you input the inches of rain. Right now, it just sets the average to 0 and then divides 0 by 3 to make total 0. You can declare them where you have them now, just put the assignments after you cin the inches.

Also, there is an issue with using getline and cin together. getline will leave the end of line character generated from pressing enter in the input stream, then when cin is called for the first time it will just take that end of line character and never ask the user for input. I'm guessing that your program doesn't let the user input the inches for the first month? At least it seems like it shouldn't. You can fix this by just using cin everywhere instead of getline, or by putting cin.ignore() before you use cin. cin.ignore will remove the end of line character from the stream, thus making cin work. Sorry if this explanation was unclear.

Remember how c++ runs the program, from top down. The program will run and declare all variables, setting them to zero then performing the actions. You pretty much write:

12

average = (0 + 0 + 0);
total = 0 / 3;

THEN you read in variables, it doesn't matter if you change the values later, nothing will update unless you call the function AFTER you have the values. You would want to move those statements below all of your cin statements.

Thank you alll for the prompt reply. However, this is only my third or fourth time writing a program and I don't quite understand what you are trying to tell me. If you could please show an example I think I will get it.

Allright! I got the program to work. Thanks everyone. I did use cin and getline together though. Because everytime I tried to use cin instead of getline, the program wouldn't even build. To help me get the full picture, how would you use cin instead of getline over here?:S