Basic C++ Flashcards
(111 cards)
selection structure (definition)
statement that allows the program to choose between alternative actions (make a decision)
selection structure (examples)
- ifj
if statement building blocks are…
- logical expressions
action
a C++ statement
C++ statements that can be actions
- output (cout)
bool data type
- used to store a logical value
bool example code
bool valid, finished;
logical (Boolean) expression (definition)
an expression that evaluates to true or false
relational operators
operators that are used to compare values
logical (Boolean) expression (facts)
- in C++, any non-zero value is considered true, 0 is considered false
relational operators (definition)
operators that are used to compare values
relational operators (examples)
< <= > >=
Equality operator (symbol)
==
Assignment operator (symbol)
=
Equality operator (==) vs. Assignment operator (=)
The equality operator (==) is used to compare values the assignment operator (=) is used to store values. It is important to use the == operator in logical expressions.
Compare like types (tip)
When creating logical expressions is to best to
logical operators (definition)
operators used to connect or change logical expressions
logical operators (examples)
! - not
Operator precedence
!
short circuit evaluation
process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.
basic if statement syntax
if (logical expression)
if statement semantics
evaluate logical expression
extended form of if statement syntax
if (logical expression)
extended form of if statement semantics
evaluate logical expression