Answer:
Replace <STUDENT CODE> with
for (i = 0; i < SCORES_SIZE; ++i) {
if(lowerScores.at(i)<=0){
lowerScores.at(i) = 0;
}
else{
lowerScores.at(i) = lowerScores.at(i) - 1;
}
}
Explanation:
To do this, we simply iterate through the vector.
For each item in the vector, we run a check if it is less than 1 (i.e. 0 or negative).
If yes, the vector item is set to 0
If otherwise, 1 is subtracted from that vector item
This line iterates through the vector
for (i = 0; i < SCORES_SIZE; ++i) {
This checks if vector item is less than 1
if(lowerScores.at(i)<1){
If yes, the vector item is set to 0
lowerScores.at(i) = 0;
}
else{
If otherwise, 1 is subtracted from the vector item
lowerScores.at(i) = lowerScores.at(i) - 1;
}
}
Also, include the following at the beginning of the program:
<em>#include <vector></em>