Hi ~ My program seems to work perfectly with the exception of validating user input. I do not want someone to do the work for me, I don't learn anything that way. I need to know why it works not just what or how. I just need a push in the right direction. I was going to post the whole program but thought better of it and am posting just the part not working.
Thanks for any help.
double getRainfallPerMonth(double rain[], int size)
{
int index = 0;
while(index >= 0)
{
for(int index = 0; index <= size - 1; index++)
{
cout << "Enter the rainfall for month " << (index+1) << ": ";
cin >> rain[index];
if(rain[index] < 0)
{
cout << "\nInvalid Entry. Please enter a postive number for monthly rainfall.\n\n";
cout << "Enter the rainfall for month 1: " << endl;
}
}
return index;
}
}