Wrox Press C++ Tutorial
In this chapter, we've assembled all of the essential mechanisms for making decisions in C++ programs. We've also gone through all the facilities for repeating a group of statements. The essentials of what we've discussed are as follows:
bool value true or false.bool values. Any non-zero value will be interpreted as true when a condition is tested, while zero is interpreted as false.if statement. Further flexibility is provided by the switch statement, and by the conditional operator.for loop, the while loop and the do-while loop. The for loop allows the loop to repeat a given number of times. The while loop allows a loop to continue as long as a specified condition returns true. Finally, do-while executes the loop at least once and allows continuation of the loop as long as a specified condition returns true.continue allows you to skip the remainder of the current iteration in a loop and go straight to the next iteration.break provides an immediate exit from a loop. It also provides an exit from a switch at the end of a group of case statements.