cplusplus:control_structures_repetition_in_algorithms
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
cplusplus:control_structures_repetition_in_algorithms [2017/02/06 17:32] – mithat | cplusplus:control_structures_repetition_in_algorithms [2019/02/11 16:39] – [Sentinel control] mithat | ||
---|---|---|---|
Line 5: | Line 5: | ||
Mithat Konar\\ | Mithat Konar\\ | ||
- | 2017-02-06 | + | 2019-02-11 |
===== Introduction ===== | ===== Introduction ===== | ||
Line 18: | Line 18: | ||
* " | * " | ||
* Uses a counter variable. | * Uses a counter variable. | ||
- | * Pseudo code:< | + | * Pseudocode:< |
While counter has not yet exceeded the STOP_VALUE | While counter has not yet exceeded the STOP_VALUE | ||
Do something | Do something | ||
Line 26: | Line 26: | ||
* **Sentinel**: | * **Sentinel**: | ||
- | * Value(s) that indicate(s) a special condition---a " | + | * Value(s) that indicate(s) a special condition --- a " |
===== Sentinel-controlled repetition ===== | ===== Sentinel-controlled repetition ===== | ||
* " | * " | ||
- | * Pseudo code:< | + | * Pseudocode:< |
While input value is not SENTINEL value | While input value is not SENTINEL value | ||
Do something | Do something | ||
Line 41: | Line 41: | ||
===== Input validation ===== | ===== Input validation ===== | ||
* " | * " | ||
- | * Pseudo code:< | + | * Pseudocode:< |
While input value is not valid | While input value is not valid | ||
Get input value from user</ | Get input value from user</ | ||
Line 47: | Line 47: | ||
===== Menus ===== | ===== Menus ===== | ||
* Repeating menus can be implemented with sentinel control. | * Repeating menus can be implemented with sentinel control. | ||
- | * Pseudo code:< | + | * Pseudocode:< |
Get menu choice from user | Get menu choice from user | ||
While input value is not QUIT value | While input value is not QUIT value | ||
Line 56: | Line 56: | ||
===== Iterators ===== | ===== Iterators ===== | ||
* Do something to every item in a collection. | * Do something to every item in a collection. | ||
- | * Pseudo code:< | + | * Pseudocode:< |
Do something with or to the item</ | Do something with or to the item</ | ||
cplusplus/control_structures_repetition_in_algorithms.txt · Last modified: 2020/02/10 21:45 by mithat