Increment the grade counter and accumulate the grade

The body of  the loop in Listing 7 begins by incrementing the grade counter by a value of 1.

During the first iteration, this will increment the counter from -1 to 0.

Then the code in the body of the loop adds the current value of temp into the sum. 

During the first pass, because the value of temp was initialized to a value of zero, this will leave the value of the sum at zero.