Navigation
index
next
|
previous
|
COMP 170
»
6. While Loops
6.1. While-Statements
6.1.1. Sum To
n
6.2. While-Statements with Sequences
6.2.1. One Character Per Line
6.2.1.1. String Backwards Exercise/Example
6.2.2. Print Vowels Function
6.2.3. IsDigits Function
6.2.4. Play Computer With a Loop
6.2.4.1. Duplicate Character Exercise
6.3. Interactive
while
Loops
6.3.1. Agree Function Exercise
6.3.2. Interactive Sum Exercise
6.3.3. Safe Whole Number Input Exercise
6.4. Short-Circuiting && and ||
6.5. While Examples
6.5.1. Bisection Method
6.5.2. Savings Exercise
6.5.3. Strange Sequence Exercise
6.5.4. Roundoff Exercise II
6.6. More String Methods
6.6.1. Count Repetitions in a String Exercise
6.6.2. Safer PromptInt and PromptDouble Exercise
6.6.3. Safest PromptInt Exercise
6.7. User Input: UI
6.8. Greatest Common Divisor
6.8.1. Euclid’s Algorithm
6.8.2. GCD “Brute Force” Method
6.8.2.1. Brute-Force GCD Exercise
6.8.3. GCD Subtraction Method
6.8.4. GCD Remainder Loop
6.8.5. Preview: Recursive GCD
6.9. Do-While Loops
6.9.1. Loan Table Exercise
6.10. Number Guessing Game Lab
6.10.1. Part 1: No Hints; Fixed Secret Number
6.10.2. Part 2: Add Hints
6.10.3. Part 3: Add a Random Secret Number
6.10.4. Part 4: Let the Player Set the Range of Values
6.10.5. Part 5: Count the Guesses
6.10.6. Possible Extra Credit Improvements or Variations
6.11. Chapter Review Questions