Professional Documents
Culture Documents
Assigment C++: Bjarne Stroustrup
Assigment C++: Bjarne Stroustrup
Bjarne Stroustrup
1.Go to
The goto statement unconditionally transfers control to the statement labeled by the
specified identifier.
2 .While
The test of expression takes place before each execution of the loop; therefore,
a while loop executes zero or more times. expression must be of an integral type, a
pointer type, or a class type with an unambiguous conversion to an integral or pointer
type.
A while loop can also terminate when a break, goto, or return within the statement body
is executed. Use continue to terminate the current iteration without exiting
the while loop. continue passes control to the next iteration of thewhile loop.
4.While True
I have seen this sort of thing used a lot, but I think it is rather strange... Wouldn't it be
much clearer to say while(true), or something along those lines?
I'm guessing that (as is the reason for many-a-programmer to resort to cryptic code) this
is a tiny margin faster?
Why, and is it really worth it? If so, why not just define it this way
5.Do/ While
The test of the termination condition is made after each execution of the loop; therefore,
a do-while loop executes one or more times, depending on the value of the termination
expression. The do-while statement can also terminate when a break, goto,
or return statement is executed within the statement body.
The expression must have arithmetic or pointer type. Execution proceeds as follows:
1. The statement body is executed.
6.Jump / Loop
Loop
Execute a sequence of statements multiple times and abbreviates the code that
manages the loop variable.
7.if / else
If
If the boolean expression evaluates to true, then the if block of code will be
executed, otherwise else block of code will be executed.
Else