1/13
Vocabulary flashcards covering relational operators, compound assignments, logical operators (including OR and NOT), the conditional operator, and switch/decision structures based on the notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Relational operators
In C++, operators that compare two values and yield a boolean result (true or false); commonly used in conditional statements like if, while, and for loops to control program flow.
True/false result
Relational operators produce a boolean result: either true or false.
Conditional statements
Structures like if, while, and for that use relational or logical expressions to control the flow of a program.
Compound assignment operators
Operators that modify a variable by applying an operation and reassigning the result; examples include +=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=.
Logical operators
Operators that connect two or more expressions to determine the logic behind decisions; essential for controlling program flow in conditional statements.
Logical OR (||)
A logical operator that yields true if either operand is true and supports short-circuit evaluation (evaluates left operand first and may skip the right if the left is true).
Short-circuit evaluation
A property where evaluation stops as soon as the overall result is determined, commonly seen with the logical OR (and AND) operators.
Logical Not (!)
The unary operator that negates a boolean expression; takes a single argument.
Conditional operator (?:)
The ternary operator that takes three operands and forms a conditional expression.
Decision (Selection) Control Structure
Control structures that allow selecting and executing specific blocks of code while skipping others.
Switch statement
A control structure that executes a block of code among many alternatives by comparing a switch expression to case labels; easier to read than a long if-else chain.
Case label
A constant value in a switch statement that, when matched with the switch expression, activates its corresponding block of code.
Default
The block of code in a switch statement that executes if no case label matches the switch expression.
Break
A statement used inside a switch to exit the current case block, preventing fall-through to subsequent cases.