### Help please

I need this program to work so that I can enter decimals instead of whole numbers. I don't know what I'm doing wrong. Can someone please help?

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071`` ``````#include using namespace std; int main() { const int SIZE = 12; // Constant for array size int values[SIZE]; // Array to hold values int index = 0; // Get the values. for (; index < SIZE; index++) { cout << "Enter the amount of rainfall for month " << index + 1 << ": "; cin >> values[index]; } double total = 0; // Step through that array, adding each element to // the accumulator. for (int index = 0; index < SIZE; index++) { total += values[index]; } //Display the total. cout << "The total amount of rainfall is " << total << endl; double average; // Calculate the average. average = total / SIZE; // Display the average. cout << "The average rainfall is " << average << endl; double highest = values[0]; // Step trough the rest of the array, beginning at // element 1. When a value greater than highest is found, // assign that value to highest. for (int index = 0; index < SIZE; index++) { if (values[index] > highest) { highest = values[index]; } } // Display the highest value. cout << "The highest amount of rainfall is " << highest << endl; double lowest = values[0]; // Step through the rest of the array, beginning at // element 1. When a value less than lowest is found, // assign that value to lowest. for (int index = 0; index < SIZE; index++) { if (values[index] < lowest) { lowest = values[index]; } } // Display the lowest value. cout << "The lowest amount of rainfall is " << lowest << endl; return 0; }``````
`int values[SIZE]; // Array to hold values `

should become

`double values[SIZE];`
Just change this:
 `` `` ``int values[SIZE]; // Array to hold values ``

To this:
 `` `` ``double values[SIZE];``
Wow. Now I feel dumb. Thank you!
Topic archived. No new replies allowed.