Thank you. From that description, it sounds as though there should be a loop, to obtain all of the inputs. I'm not sure whether it should output anything at all during that loop.
Perhaps the data for the students should be stored in an array, and processed later, after the mark exceeding 100 has been entered?
If that is so, then the if statements you have would need also to be inside a loop (or make it into a separate function, which is called inside a loop).
I still have difficulty understanding the code posted so far. I was thinking of something like this, but I still don't understand:
1 2 3 4 5 6 7 8 9 10 11 12
|
cout << grade << endl;
if (grade < 0)
cout << "error\n";
else if (grade <= 29)
cout << "Category 1 - **" << endl;
else if (grade <= 39)
cout << "Category 2 - *****" << endl;
else if (grade <= 69)
cout << "Category 3 - ********" << endl;
else if (grade <= 100)
cout << "Category 4 - ****" << endl;
|
For example, why is the grade incremented with the ++ operator like this:
and what is the purpose of the for-loop.
Also why are there fewer asterisks printed for the highest scoring students (70 to 100 get only four stars)?
I'm sure there's a bigger picture here but I'm not getting it yet.