C++ Programming: Relational, Logical, and Control Structures

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

Relational Operators

Used to compare numbers to determine relative order.

2
New cards

Relational Expression

A Boolean expression that evaluates to either true or false.

3
New cards

Relational Expression (Assignment)

"When assigned to an integer variable, it assigns 1 for true and 0 for false."

4
New cards

Assignment Operator (=)

Used to assign a value to a variable.

5
New cards

Equality Operator (==)

Used to test for equality in a comparison.

6
New cards

Floating-Point Equality Test

Requires care when testing float and double types for equality.

7
New cards

Conditional Expression (Truth)

"In C++, the value 0 is false; any other value is true."

8
New cards

Flowchart

A diagram used to visually evaluate a decision or program logic.

9
New cards

Nested if Statement

An if statement that is entirely contained within another if or else if statement.

10
New cards

if Statement Initialization

A C++17 feature where an optional initialization clause is executed before the conditional expression is evaluated.

11
New cards

General if Initialization Format

if (initialization; expression).

12
New cards

Flag

A variable that signals a condition.

13
New cards

Flag Implementation

Usually implemented as a bool variable or an integer.

14
New cards

Flag (Boolean Values)

An integer flag treats 0 as false and any nonzero value as true.

15
New cards

Flag Initialization

Must be assigned an initial value before being used in functions.

16
New cards

Logical Operator Precedence (Highest)

The NOT operator (!) has the highest precedence.

17
New cards

Logical Operator Precedence (Middle)

The AND operator (&&) has the second-highest precedence.

18
New cards

Logical Operator Precedence (Lowest)

The **OR operator (`

19
New cards

Short Circuit Evaluation

"If the value of an expression is determined by the left sub-expression, the right sub-expression is not evaluated."

20
New cards

Menu-Driven Program

A program whose execution is controlled by a user selecting from a list of actions.

21
New cards

Menu

A list of choices displayed on the screen.

22
New cards

Conditional Operator

Used to create short if/else statements.

23
New cards

Conditional Operator Format

expr1 ? expr2 : expr3;.

24
New cards

Conditional Operator (expr1)

The expression to be tested (the condition).

25
New cards

Conditional Operator (expr2)

The value returned if the first expression (expr1 is true).

26
New cards

Conditional Operator (expr3)

The value returned if the first expression (expr1 is false).

27
New cards

switch Statement Expression Requirement

The controlling expression must be an integer variable or an expression that evaluates to an integer value.

28
New cards

switch Case Value Requirement

exp1 through expn must be constant integer expressions or literals and must be unique.

29
New cards

default Statement

The optional but recommended clause in a switch statement that executes if no case matches.

30
New cards

switch Statement Initialization

A C++17 feature where an optional initialization clause is executed before the conditional integer expression is evaluated.

31
New cards

General switch Initialization Format

switch (initialization; IntegerExpression).

32
New cards

Scope of a Variable

"The block in which it is defined, extending from the definition point to the end of the block."

33
New cards

Local/Block Scope

Variables defined inside curly braces {} have this type of scope.

34
New cards

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) ."