C++ Control Statements for Decision Making

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

flashcard set

Earn XP

Description and Tags

Vocabulary and concepts regarding C++ decision-making control statements including if-else structures and switch cases.

Last updated 5:27 PM on 8/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

15 Terms

1
New cards

Decision Making (Selection) Statements

Programming logic that evaluates a condition (true/false) to direct the flow of execution to specific blocks of statements.

2
New cards

if Statement

A control statement where a block of code is executed only if the specified condition evaluates to true (non-zero).

3
New cards

if-else Statement

A selection statement that executes one block of code if a condition is true and a different block if the condition is false.

4
New cards

Nested if Statement

An if or if-else statement placed inside another if or if-else statement, used when a decision depends on the outcome of a previous decision.

5
New cards

if-else-if Ladder

A structure used to check multiple conditions in sequence; the first true condition's block executes and the remaining blocks are skipped.

6
New cards

switch Statement

A multi-way decision-making statement that tests the value of an expression against a list of constant case values to execute a matching block.

7
New cards

break Statement

A command used to terminate the switch block; if omitted, execution 'falls through' into the subsequent case.

8
New cards

default Case

An optional block in a switch statement that executes only when none of the constant case labels match the expression's value.

9
New cards

Valid switch Expression Data Types

Data types including "int", "char", and "enum" that can be used in a switch statement; "float", "double", and "string" are not supported.

10
New cards

Fall-through

A situation in a switch statement where execution continues into the next case because a break statement was omitted.

11
New cards

Dangling else Problem

An ambiguity where it is unclear which "if" an "else" belongs to; resolved in C++ by associating the "else" with the nearest unmatched "if" or using braces {}.

12
New cards

Conditional (Ternary) Operator

A shorthand way of writing a simple if-else statement using the syntax "condition?expression1:expression2condition ? expression1 : expression2".

13
New cards

Leap Year Rule

A year is a leap year if it is divisible by 44, but century years must also be divisible by 400400.

14
New cards

Relational Operators

Symbols like >>, <<, and >=>= used in if-else-if ladders to check for ranges (e.g., marks >=60>= 60) which are not directly supported by switch statements.

15
New cards

Logical Operators

Operators such as "&&" (AND) and "||" (OR) used within selection statements to combine multiple conditions.