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 [2013/03/01 00:53] – mithat | cplusplus:control_structures_repetition_in_algorithms [2014/02/24 22:12] – mithat | ||
---|---|---|---|
Line 2: | Line 2: | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
- | ====== Control Structures: Repetition in algorithms | + | ====== Control Structures: Repetition in Algorithms |
Mithat Konar\\ | Mithat Konar\\ | ||
- | 2013-02-03 | + | 2014-02-24 |
===== Introduction ===== | ===== Introduction ===== | ||
Line 11: | Line 11: | ||
* Input validation | * Input validation | ||
* Sentinel/ | * Sentinel/ | ||
- | * Menus | ||
* Counter control | * Counter control | ||
* Iterators | * Iterators | ||
===== Input validation ===== | ===== Input validation ===== | ||
- | * "Do not continue with program | + | * "Prevent moving to next section |
* Pseudo code:< | * Pseudo code:< | ||
While input value is not valid | While input value is not valid | ||
Get input value from user</ | Get input value from user</ | ||
- | ===== Sentinel/flag control ===== | + | ===== Sentinel control ===== |
* **Sentinel**: | * **Sentinel**: | ||
- | * Value(s) that indicate(s) a special condition; " | + | * Value(s) that indicate(s) a special condition---a " |
- | * **Flag**: | + | |
- | * Sometimes used as a synonym for sentinel | + | |
- | * Sometimes means a sentinel that is a Boolean value | + | |
===== Sentinel-controlled repetition ===== | ===== Sentinel-controlled repetition ===== | ||
Line 36: | Line 32: | ||
Get input value</ | Get input value</ | ||
* Input validation might be considered a special case of sentinel controlled repetition. | * Input validation might be considered a special case of sentinel controlled repetition. | ||
+ | * **Flag**: | ||
+ | * Sometimes used as a synonym for sentinel | ||
+ | * Sometimes means a sentinel that is a Boolean value | ||
===== Menus ===== | ===== Menus ===== | ||
Line 48: | Line 47: | ||
===== Counter-controlled repetition ===== | ===== Counter-controlled repetition ===== | ||
* " | * " | ||
- | * Uses a counter variable | + | * Uses a counter variable. |
* Pseudo code:< | * Pseudo code:< | ||
While counter has not yet exceeded the STOP_VALUE | While counter has not yet exceeded the STOP_VALUE | ||
Line 56: | Line 55: | ||
===== Iterators ===== | ===== Iterators ===== | ||
- | * Later | + | |
+ | * Pseudo code:< | ||
+ | Do something with or to the item</ | ||
cplusplus/control_structures_repetition_in_algorithms.txt · Last modified: 2020/02/10 21:45 by mithat