One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a named location that stores a value.
Just as there are different types of values (integer, character, etc.), there are different types of variables. When you create a new variable, you have to declare what type it is.
The type of a variable determines what kind of values it can store. A char variable can contain characters, and it should come as no surprise that int variables can store integers.
where bob is the arbitrary name you made up for the variable. In general, you will want to make up variable names that indicate what you plan to do with the variable. For example, if you saw these variable declarations:
char firstLetter;
char lastLetter;
int hour, minute;
you could probably make a good guess at what values would be stored in them. This example also demonstrates the syntax for declaring multiple variables with the same type: hour and minute are both integers (int type).
int main() {
int x = 7;
int y = 10;
char c = β8β;
while (x < y) {
cout << c << endl;
x++;
}
double d = 9;
int z = x + y;
cout << "It's the year " << 2000 + z << "!";
}
Arrange the code blocks to create the variables name, firstInitial, and numberOfSiblings IN THAT ORDER. It is up to you to choose the correct types for these variables.