Week 7 (making decisions 3) Flashcards
What is the scope of variables?
Live and die by the block
When can you use variables with the same name?
When they are in nested blocks
How can you compare chars?
with the greater than and less than operators, as well as the ==
How do you compare string objects?
with < , > , == (compares char for char and if they are all equal then the whole thing is equal.
what is the conditional operator? (syntax)
first expression to be tested ? executes if true : executes if false;
syntax for switch statement
switch (IntegerExpression)
case ConstantExpression:
statement;
break;
what is an enumerated data type?
set of named integer constants
Are enums string literals?
No, they are named constants.
Can you set enums = 1;
no
how to check if files exsist
if (!inputfile)
if(inputFile.fail)