C++ Demystified(c) A Self-Teaching Guide
-
The increment operator increases a value by one.
-
The decrement operator decreases a value by one.
-
In the statement cout << --num, decrementing occurs before the outputting of the value of num because the decrementing is prefix.
-
An iteration is each time a loop repeats.
-
The usual purpose of the first expression in the parentheses following the for keyword is to initialize a variable which usually serves as the counter.
-
The purpose of the second expression in the parentheses following the for keyword is to set the condition which must be true for the loop to continue to execute.
-
The usual purpose of the third expression in the parentheses following the for keyword is to update a value, usually a counter.
-
One or more of the expressions in the parentheses following the for keyword may be empty if handled elsewhere in the code.
-
The purpose of the break keyword in a for loop is to prematurely terminate the loop.
-
The purpose of the continue keyword in a for loop is to prematurely terminate the iteration of a loop.
-
If you were going to use nested for loops to print rows and columns, you would use the inner for loop to print the columns .
Категории