411 REFERENCE · Wikibooks
Intro To C++/Making '''''statement'''''
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Controlling with if and else
The C++ if keyword performs the basic conditional test. If something is true, then perform action. And it's syntax looks like this:
if(test-expression){statements-to-perform-when-true}
We could want the different action if that relationship is false. By appending else statement, it is possible.if-else statement looks like this:
if(test-expression){statements-to-perform-when-true}
else{statements-to-perform-when-true}
Controlling with switch
When we have multiple case to check, using if-else statement repeatedly is not efficient.In this case, switch is more useful.
Looping for
Looping while
Declaring & Defining Functions