Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
83 Cards in this Set
- Front
- Back
Greater then or equals operator >=
|
The greater then or equals operator returns true if the left hand operand is greater than or equals the right hand operator, otherwise it returns false.
|
|
Less than or equals operator <=
|
The less than or equals operator returns true if the left hand operand iis less than or equals the right hand operator, otherwise it returns false.
|
|
Greater than operator >
|
The greater than operator returns true if the left hand operand is greater than the right hand operator, otherwise it returns false.
|
|
Less than opertor <
|
The less than operator returns true if the right hand operand is less than the right hand operator, otherwise it returns false.
|
|
Not equals operator !=
|
The not equals operator returns true if the two operands are not equal, otherwise it returns false.
|
|
Equals operator ==
|
This operator retuns true if the two operands ae equal, otherwise it retuns false.
|
|
In the statement "If the player's hitpoints are less than zero then he is dead" the antecdent would be ____ and the consequent would be
|
antecdent: "The player's hitpoints are less than zero"
consequent: "He is dead" |
|
The statement which follows the "than" is called the.
|
Consequent
|
|
The statement after the "if" and before the "than" is calle the...
|
antecedent
|
|
Part 3 of a for-loop
|
This can be any C++ statment. However, it is usually used to modify the counting variable in some way.
|
|
Greater then or equals operator >=
|
The greater then or equals operator returns true if the left hand operand is greater than or equals the right hand operator, otherwise it returns false.
|
|
Less than or equals operator <=
|
The less than or equals operator returns true if the left hand operand iis less than or equals the right hand operator, otherwise it returns false.
|
|
Greater than operator >
|
The greater than operator returns true if the left hand operand is greater than the right hand operator, otherwise it returns false.
|
|
Less than opertor <
|
The less than operator returns true if the right hand operand is less than the right hand operator, otherwise it returns false.
|
|
Not equals operator !=
|
The not equals operator returns true if the two operands are not equal, otherwise it returns false.
|
|
Equals operator ==
|
This operator retuns true if the two operands ae equal, otherwise it retuns false.
|
|
In the statement "If the player's hitpoints are less than zero then he is dead" the antecdent would be ____ and the consequent would be
|
antecdent: "The player's hitpoints are less than zero"
consequent: "He is dead" |
|
The statement which follows the "than" is called the.
|
Consequent
|
|
The statement after the "if" and before the "than" is calle the...
|
antecedent
|
|
Part 3 of a for-loop
|
This can be any C++ statment. However, it is usually used to modify the counting variable in some way.
|
|
C++ provides the following syntax for an alternate array initialization
|
int intarray [8] = {-4, 6, -2, 0, 33, 78, 0, 4};
|
|
In general, a conditional statement takes on the form:
|
"If A is true then P follows" Where A is some boolean expression on the condition that A is true.
|
|
Logical NOT (!) truth table
|
A !A
T F F T |
|
Logical OR (||) truth table
|
A B A || B
T TT T T F T F T T F F F |
|
The logical AND (&&) truth table
|
A B A && B
T T T T F F F T F F F F |
|
The '!' operator is a unary operator which acts
|
on one operand
|
|
The '&&' and '||' operators are binary operators; that is, they
|
act as two operands
|
|
A logical not operator
|
!
|
|
A logical inclusive or operator
|
||
|
|
A logical and operator
|
&&
|
|
The ternary operator is a
|
Compact notation to represent a basic if...else statement. It is the only operator that takes three operands
|
|
The break statement essentially exits out of the switch statement, which is typically...
|
Desired after a particular case was handled
|
|
An important fact about the switch statement is that a....
|
Break statement is necessary following your case handling code.
|
|
The switch statement is essentially a...
|
Cleaner version to nested if...else statements.
|
|
We can access a specific element in a matrix using the...
|
Double bracket syntax and supplying two array indices, which identifies the row and column of the element.
|
|
And if...else statement can branch execution along two seperate paths...
|
One path if teh condition is true or a second path if the condition is not true.
|
|
The else clause allows us to say things like
|
"If A is true then P follows, else Q follows"
|
|
More than one statement can be executed in consequence but to do so we must...
|
Use a compound statement, which is a set of statements enclosed in curly braces.
|
|
C++ treats zero as false and non-zero numbers....
|
Posotive or negative as true.
|
|
We use conditional statements to...
|
Control program flow.
|
|
Relational operators are a type of...
|
Boolean expression
|
|
Arrays are zero based, that is...
|
The first element in the array is identified with an index of zero. And therefore, the 1st element is identified with an index of n-1, where n is the total number of elements.
|
|
A specific element in an array code can be accessed using the...
|
Bracket operator and supplying an array index, which identifies the element.
|
|
Pary 4 of a for-loop
|
This part contains the statement which you want to execute for every cycle of the loop.
|
|
N is an integer constant that....
|
Specifies the number of elements the array contains.
|
|
To declare an array we use the following general syntax:
|
type identifier [n]
|
|
We call the number of elements an array holds the...
|
Array size
|
|
Part 2 of a for-loop...
|
This is the conditional part: that is, the loop continues to loop only so long as this condition is true.
|
|
The individual variables in an array are the...
|
Elements of an array.
|
|
An array is a contigous block of memory that contains...
|
n number of variables.
|
|
A do...while is gauranteed to...
|
Execute at least once.
|
|
The while...loop takes on the following general syntax:
|
While (condition is true) execute this C++ statement.
|
|
The while-loop is commonly used when ...
|
You need to repeat some statements an unknown number of times .
|
|
Part 1 of a for-loop...
|
This can be any C++ staement. However it is usually used to initialize a counting variable; that is, a variable that counts the loop cycles.
|
|
The for-loop is commonly used when..
|
You need to repeat some statements a known number of times.
|
|
The ternary operate may be used as follows:
|
If bool expression is true than the turnary operation evaluates to value 1, else it evaluates to value 2.
B is of the type bool int x = b ? 10 : -5; |
|
The general syntax of a ternary operator...
|
(bool expession ? value 1 : value 2)
|
|
cout.setf(ios_base::boolalpha); this line is used to...
|
Set formatting flags, which control the way cout outputs information.
|
|
Just as if...else statements can be nested, loops can be nested: that is...
|
a loop inside a loop.
|
|
It is possible to have an array of arrays; that is...
|
An array where each individual element is also an array.
|
|
Essentially the do...while loop says...
|
"Do these statements at least once regardless of the condition, then while the condition holds, continue to do these statements"
|
|
Declaring a set of variables of the same type in a compact way using an....
|
Array
|
|
True or false. You can replace a switch statement with nested if-else statement that has the same program flow as the swithc statement
|
True
|
|
True or false, the following is a valid for loop..
for (float x = 1.5f; x < 55.0f; x*=2.0f) cout << x << endl; |
True
|
|
True or false, A while loop is most often useful when you do not know at compile time how many times you want to loop.
|
True
|
|
True or false, a do-while loop is guarenteed to execute at least n times, where n is any posotive integer, regardless of the conditions turth-value.
|
False
|
|
The ________ keyword can be used to exit immediately from a loop. The______ keyword immediately jumps to the next cycle of the loop.
|
break and continue
|
|
True or false, 5d arrays are illegal in C++
|
False
|
|
Arrays are continuous blocks of....
|
memory
|
|
An element in an array can be accessed by supplying an...
|
index to the bracket operator
|
|
The size of an array depends on...
|
How many elements it has.
|
|
The relational operators allow us to determine certain elementary relationships between variables such as....
|
Equality and inequality
|
|
We use three logical operators:
|
the logical AND operator (&&), the logical OR operator (||) and the logical NOT operator (!)
|
|
The three logical operators allow us to form more complex...
|
Boolean expressions and therefore enable us to make more useful conditonal statements.
|
|
Conditionals are key to any program that needs to.....
|
Make decisions at runtime.
|
|
Conditionals allow us to make certain that a block of cide will only be executed if a...
|
Particular condition is satisfied (i.e. if this condition is true then execute this code)
|
|
Loops enable us to repeat a block of code a...
|
variable number of times.
|
|
An array is a contigous block of memory that contains...
|
n amount of variables.
|
|
The IF statement:
|
if ( logical expression == true)
then execute this statement; |
|
The ELSE clause:
|
if ( playerInjured == true)
{ playerInjuredanimation (); displayWarning(); } else playHealthyAnimation (); |
|
C++ supports three loop styles...
|
the for loop, the while loop, the do while loop
|
|
The FOR loop:
|
for (int cnt = 0; cnt < 100; ++cnt)
{ cout << cnt << ": Hello, World!" << endl; } |
|
The DO-WHILE loop:
|
bool conditon = false;
do { cout << "Enter a 0 to quit or 1 to continue:"; cin >> condition; } while (condition ); |