The sentinel loop

The sentinel loop is shown in its entirety in Listing 4.

As mentioned earlier, if the value of temp that was read in Listing 3 is -1.0, the body of the while loop will be bypassed and the program will terminate.