whoyou.cc consists of several
statements. The statements are executed in the order in which they
appear, starting from the first.
name. Variables are also called identifiers. All identifiers in C++ must be declared before they are used. All must have a datatype. Here
ageis an integer and
nameis a string of characters of maximum length . The commonly used basic datatypes in C++ and the number of bits they use on our system are
||Integer (32 bits)|
||Floating point (32 bits)|
||Floating point (64 bits)|
||Single character (8 bits = 1 byte)|
To get more than one character we specified the length in brackets 
after the name. We asked for 10 characters, but the last one (a null
character) is reserved to indicate the end of the string, so only 9
are available. The brackets make
name the name of an
array. We will discuss arrays later. For now, simply use this
pattern for char strings.
name are our own
invention. Variable names are composed of upper and lower case
letters (case sensitive), digits, and the underscore
character. They must begin with a letter but can be of any length
with modern compilers. A couple dozen names are reserved by the
compiler. For example
char are used
to specify the datatype, so they can't be used for names. Other names,
cin, are already in use for
other purposes, so they, too, can't be used.
iostreamprovides for reading data from the Unix standard input device (usually the keyboard). You could split this statement in two:
cin >> name; cin >> age;and it would do the same thing. The
>>in this context causes the keyboard words to be converted and stored as the specified type. As a mnemonic, the
>>can be thought of as pointing in the direction of the data flow.
name. Just as
coutlets us string together multiple output values with
<<between each of them.
Notice that this single statement is broken into two lines for readability. The compiler ignores line breaks in statements. That is why the semicolon is required to signal the actual end of the statement.