1/18
Vocabulary flashcards summarizing key C++ operators, conditional statements, and repetitive structures covered in the lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Increment Operator (++)
Unary operator that increases an operand’s value by 1.
Decrement Operator (--)
Unary operator that decreases an operand’s value by 1.
Post-Increment (x++)
Returns the original value of x, then increases x by 1.
Post-Decrement (x--)
Returns the original value of x, then decreases x by 1.
Pre-Increment (++x)
Increases x by 1 first, then returns the new value.
Pre-Decrement (--x)
Decreases x by 1 first, then returns the new value.
Conditional Operator (?:)
Ternary operator that selects one of two expressions: expr1 ? expr2 : expr3 acts like if(expr1) expr2; else expr3.
Explicit Type Cast (type)expr
Forces conversion of expr to a specified data type, e.g., (double)x or (char)(p-32).
if Statement
Executes a block when a condition is true; can be paired with else for the false path.
switch Statement
Selects and executes code blocks based on the value of an integral expression.
case Label
Constant integral value inside a switch that marks the start of a code block to execute when matched.
default Label
Optional block in a switch executed when no case value matches.
break Statement (in switch)
Exits the switch, preventing fall-through to subsequent cases.
Fall-Through (missing break)
Behavior where execution continues into the next case until a break is reached.
for Loop
Counter-controlled loop used when the number of iterations is known.
while Loop
Condition-controlled loop that tests the condition before each iteration.
do-while Loop
Condition-controlled loop that tests the condition after executing the loop body at least once.
break Statement (in loops)
Immediately terminates the nearest enclosing loop or switch.
continue Statement
Skips the remaining loop body and starts the next iteration.