Hi,
I've written the following function and am having trouble with input validation so that my program displays:
Score 1:
Score 2:
Score 3:
Score 4:
Score 5:
for the user to enter a score between 1 and 10. If a number other than 1-10 are entered, it should repeat the previous statement until an appropriate number is entered.
Here is my code. This is for an assignment, so I'm just looking for any comments as to where I might have gone wrong so that I can get back on the right track.
Thank you.
Code:float getScores(float scores[], int JUDGES) { int count = 0; do { for(count = 0; count < JUDGES; count++) { cout << "Score " << (count + 1) << ": "; cin >> scores[count]; } }while (scores[count] > 0.0 && scores[count] <= 10.0); return scores[]; }




Reply With Quote
