Unformatted text preview: • Ways of ending a loop 1. List headed by size 2. Ask before iterating 3. List ended with a sentinel value 4. Running out of input • Be careful and check if it’s off by one to fix common errors • When debugging, can trace the status of a variable by a cout statement at each loop • “If your program is very bad, do not try to debug it. Instead, throw it out and start over”...
View Full Document
- Fall '08
- sentinel value, Ex. int number, Basic Loop Syntax, C++ Loop Statements