Variables Flashcards
To understand Variables in C++
What is Declaring?
When you set or declare the data type and name of the variable. These two properties of a variable do not change.
What is Assigning?
When you set the value of the variable. The value of a variable can change
What is Accessing
When you retrieve the value of the variable by calling its
name.
What does each variable in C++ have?
It has
1. A data type
2. A name
3. A value
What are integers?
Integers (also known as int ) are whole numbers. They can be positive or negative.
When writing large numbers, what must you NOT do?
You should NOT use a comma when typing large numbers.
What are Floating Point Numbers?
Floating Point Numbers (also known as float) are numbers with a decimal. They can be positive or negative.
The data type Float only uses 4 bytes? What is the better more sufficient option?
The more sufficient option is double which uses 8 bytes or double the space of a float.
What values can a boolean variable take?
A boolean variable (declared as a bool) can only take the value of true and false.
What is the boolean value “true” equivalent to?
It is equivalent to 1
What is the boolean value “false” equivalent to?
It is equivalent to 0
What happens if you use the boolalpha command?
It prints the boolean value true/false instead of it’s association 1/0.
What is a string?
A string is a collection of text, numbers or symbols. Strings are always surrounded by quotation marks.
What isn’t visible when printing a string?
The quotation marks aren’t printed with the collection of text, numbers or symbols.
What are the 2 parts of declaring a variable?
You have to set or declare the data type and the name of the variable. These 2 properties do not change.