Loops and switches Flashcards

1
Q

while loop

A

while (this case is true) {

we will execute this}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

for loop

A

a loop with a built in iteration system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

for loop syntax

A

for(int I =0; i<10; i++)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

iterational statement

A

the statement that iterates the loop for you

if there is no iteration statement then you have an infinite loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

switch statement format

A
switch(variable value)
    case "a"
stuff
break
case "b:"
...
break
default
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

break in a switch statemtn

A

stops the code below from being executed

without it the next case executes too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

default in switch statement

A

the default will execute if none of the cases execute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

for(x=1;x<=10;x=x+1) cout &laquo_space;x

A

1 2 3 4 5 6 7 8 9 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

do while loops

A

loops that execute before giving the case statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

code for do-while loop

A
do
{
statement;
}
while (expression);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Format for for loop

A

for (initialization; test; update)
statement;

EX for (count = 0; count < 5; count ++)
cout << "Hello!" << endl;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

I++

A

post incriment uses the current value of i and then incrtiments for next time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

++I

A

pre incriment uses the incrimented value of I and then incriments for next time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

nested loop

A

one loop inside of another loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

kill the program

A

ctrl c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly