Incremental looping

for (Variable=Start Value; Comparison Statement; increment/decrement Variable)

{ Statement; Statement;…}

(Execute the statements as long as the variable is true in the comparison statement, then increment or decrement the variable. Variable starts at the defined Start Value.)

Example:

For (X=0; X<=10; X++)   cout << X << endl;

(If X is less than or equal to 10, then print the value of X at that time, then increment X.)


Feedback