Okay folks, I'm completely lost, I'm new to C++ and have no idea how to start. I'm aware that there's "no doing peoples homework" rule in affect, but I'm several chapters behind and am trying to catch up. With that said, can someone please at least get me started or show me an example similar to this problem. The help is greatly appreciated and I'll buy you a donut if you can help:
Write a program that prompts the user to input seven values – each value represents the number of inches of rainfall on a particular day of the week. (Note: The values may be whole units such as 2 or 5 or fractional values such as 2.5 or 1.33. Make sure you chose an appropriate data type to handle either type of data.) Based on the input, calculate the total rainfall and average rainfall for the seven days period. Output the total and average in decimal form.
Please, I am begging, please help. Thanks in advance.
But first, do you know about arrays and loops?
1 2 3 4 5 6 7 8 9 10 11
float inch; //declare an array of int called inch, with 7 elements(ie: 0-6 will be the index for the elements.
cout<<"Enter seven values: "; //Hope you know this
for(int i=0;i<6;i++) //a for loop that runs as long as i<6, and i increases everytime the loop runs completely.
cin>>inch[i]; //fills every element of the array, with user input. This works based on the value of i.
//Hope you can do the rest!
Else if no:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cout<<"Enter seven values: ";
cin>>inch1>>inch2>>inch3>>inch4>>inch5>>inch6>>inch7; //This "fills" or assigns each variable with a value based on user input. Note that any space or newline character will cause the value after the whitespace character to be given to the next variable.