1/33
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Relational Operators
Used to compare numbers to determine relative order.
Relational Expression
A Boolean expression that evaluates to either true or false.
Relational Expression (Assignment)
"When assigned to an integer variable, it assigns 1 for true and 0 for false."
Assignment Operator (=)
Used to assign a value to a variable.
Equality Operator (==)
Used to test for equality in a comparison.
Floating-Point Equality Test
Requires care when testing float and double types for equality.
Conditional Expression (Truth)
"In C++, the value 0 is false; any other value is true."
Flowchart
A diagram used to visually evaluate a decision or program logic.
Nested if Statement
An if statement that is entirely contained within another if or else if statement.
if Statement Initialization
A C++17 feature where an optional initialization clause is executed before the conditional expression is evaluated.
General if Initialization Format
if (initialization; expression).
Flag
A variable that signals a condition.
Flag Implementation
Usually implemented as a bool variable or an integer.
Flag (Boolean Values)
An integer flag treats 0 as false and any nonzero value as true.
Flag Initialization
Must be assigned an initial value before being used in functions.
Logical Operator Precedence (Highest)
The NOT operator (!) has the highest precedence.
Logical Operator Precedence (Middle)
The AND operator (&&) has the second-highest precedence.
Logical Operator Precedence (Lowest)
The **OR operator (`
Short Circuit Evaluation
"If the value of an expression is determined by the left sub-expression, the right sub-expression is not evaluated."
Menu-Driven Program
A program whose execution is controlled by a user selecting from a list of actions.
Menu
A list of choices displayed on the screen.
Conditional Operator
Used to create short if/else statements.
Conditional Operator Format
expr1 ? expr2 : expr3;.
Conditional Operator (expr1)
The expression to be tested (the condition).
Conditional Operator (expr2)
The value returned if the first expression (expr1 is true).
Conditional Operator (expr3)
The value returned if the first expression (expr1 is false).
switch Statement Expression Requirement
The controlling expression must be an integer variable or an expression that evaluates to an integer value.
switch Case Value Requirement
exp1 through expn must be constant integer expressions or literals and must be unique.
default Statement
The optional but recommended clause in a switch statement that executes if no case matches.
switch Statement Initialization
A C++17 feature where an optional initialization clause is executed before the conditional integer expression is evaluated.
General switch Initialization Format
switch (initialization; IntegerExpression).
Scope of a Variable
"The block in which it is defined, extending from the definition point to the end of the block."
Local/Block Scope
Variables defined inside curly braces {} have this type of scope.
Inner Block Variable Definition
"A variable defined in an inner block can have the same name as one in the outer block, but the outer definition is not available inside the inner block. (Note: This practice is generally not a good idea) ."