C ++ beginners, what books do c beginners read?
Today, I learned how to write c ++ statements.
Because c was used in programming, the first time I saw some code in c ++, I was a little confused and busy.
When I first came into contact with c ++, I learned the definition of variables and input and output in c ++.
The Code is as follows:
# Include <iostream>
Int main ()
{
Int I;
Float f = 6.1f;
Std: cin> I;
Std: cout <I <"" <f <std: endl;
Return 0;
}
First, when writing the code, the header file used for output in c ++ is very different from that in c. The header file used for output in C is <stdio. h>, while c ++ uses <iostream>
In addition, the output statements of c ++ and c are quite different. The output in c ++ applies the cout function in <iostream>.
The writing format is also different from that of c. The data to be output must be included in <.
On the contrary, we can clearly find that the input is "" ", the direction of the arrow is opposite, and the right arrow is missing compared with the input.
Second, c ++ and c are slightly different in the definition and assignment of variables:
The definition of variables in c ++ is different from that in c ++. The difference lies in the assignment of variables:
C directly input "variable = value" when assigning values to variables, for example:
Float f = 5.2;
In addition to integer variables, c ++ must add a type indicator after the value, for example:
Float f = 5.2f;