I have the following array which is adding the numbers entered by the user the issue I'm having is that it only works if the user enter whole numbers, but if the user enters decimals like .2, .3 etc it doesn't add the numbers.
int main()// start main
{
constint MONTHS = 4;
double monthArrey[MONTHS];
int total = 0;
cout<< "Enter rainfall for each month: " << endl;
cout<< endl;
for(int i = 0; i < MONTHS; i++ )
{
cin >> monthArrey[i];
}
cout<< "Rainfall numbers: " << endl;
int j =0;
while (j<MONTHS) {
total += monthArrey[j];
j++;
}
cout << "Total: "<< total <<" ";
return 0;
} // end main