I have a class assignment where I read in scores from 5 users and I am supposed to
find the highest and lowest scores. I can't use arrays and I can only use functions and loops.
Your getJudgeData function won't work correctly if you input an invalid score. Try tracing through it yourself (or use a debugger) and see what happens.
I'm not sure how using a loop would help you in the second case if you don't have an array. As for your actual problem statement there, how would you do it in real life? Try to implement something similar with your code.
int score;
cout << "Enter a score between 1 and 10." << endl;
cin >> score;
while (score < 0 || score > 10)
{
cout << "Invalid. Enter score between 1 and 10.\n";
cin >> score;
}
The problem was that it was still accepting the values even though it said invalid.
As for the second case, I used a bunch of if statements. Can someone check if it'll work or is there a better way?: