|
Is a sentinel always going to be an integer? A good answer might be:No, probably not. |
New ExampleSometimes the user needs to be explicitly asked whether the loop should continue. The user will enter "yes" or "no" (or maybe "y" or "n"). The sentinel will be of type String or char. The next example illustrates this:
Say that you were interested in the value of the polynomial
|
QUESTION 14:Would using a special value of x (such as 0.0) as a sentinel work well in this program? Click Here after you have answered the question |