COSC-1337 Chapter 4 Flashcards
What is a semi-colon used for in C++?
A semi-colon is used ONLY after you have written a complete statement.
What happens if you accidentally put a semi-colon after the “if (condition)”?
The semi-colon will become a “null terminator” and the statements in the block following the “if statement” will execute regardless of wether or not the conditions are met.
A “null terminator” is considered a blank statement in C++ that does nothing. This would result in terminating the “if statement” early.
When a message is printed to let the user know that they have entered in invalid input, what is this called?
Input validation
What is “is alpha()” used for?
To test whether or not a variable or input is a alphabetic character
Variables that are defined inside the set of braces are known to have a?
Local scope or Block scope
What does a conditional operator look like?
x >= 0 ? y = 1 : z = 25;
What type of operator is a conditional operator known as?
Ternary operator. This is because it has three operands.
Does a switch structure recognize both upper case and lower case letters?
Yes.
How do we create a data type named “Names” and assign the values of 22, 55, and 205 to the variables Tim, Jim, Pam?
enum Names {Tim = 22, Jim = 55, Pam = 205};
What file header do you need to use with things like isalpha();?
cctype header file