Conditional Statements
- Conditional statements alter the sequential flow of the program
- Also called selection statements, branch statements, control structures, alternation
- These statements transfer control to a statement other than the one that is physically next in the code
- The conditional statement contains an expression that evaluates to either TRUE or FALSE; these expressions are called boolean expressions
- C++ doesn't have a built-in boolean type; TRUE is represented by a 1, and FALSE is represented by a 0
- We can define a new type called Boolean, and use that in our programs; we can use the typedef keyword to define other types
- We can also define the words TRUE and FALSE to represent 1 and 0
- The primary conditional statement is the if statement
Next page
Go to Lesson 7 index.