Week 7 (making decisions 3) Flashcards Preview

C++ > Week 7 (making decisions 3) > Flashcards

Flashcards in Week 7 (making decisions 3) Deck (10):
1

What is the scope of variables?

Live and die by the block

2

When can you use variables with the same name?

When they are in nested blocks

3

How can you compare chars?

with the greater than and less than operators, as well as the ==

4

How do you compare string objects?

with < , > , == (compares char for char and if they are all equal then the whole thing is equal.

5

what is the conditional operator? (syntax)

first expression to be tested ? executes if true : executes if false;

6

syntax for switch statement

switch (IntegerExpression)
case ConstantExpression:
statement;
break;

7

what is an enumerated data type?

set of named integer constants

8

Are enums string literals?

No, they are named constants.

9

Can you set enums = 1;

no

10

how to check if files exsist

if (!inputfile)

if(inputFile.fail)