1, written in the second chapter before the words (personally think it is very useful)
- Programming language has some common features, built-in data types, expressions and statements, variables, control structures, functions;
- Then, it is provided to the user of the language, two ways to expand the above basic features:
- Allows programmers to define their own data types (such as class types)
- A standard library of languages, with standard functions and data types (nothing more than the type of class that a master writes, such as String,vector, etc.)
- In C + +, the type of a variable determines what actions the variable can perform, such as int a1 for integer variables, support + 、-、 *,/And so on
- Python is run-time only to check the type of variables in the statement
- C + + is a statically typed language, and at compile time, type checking
- No wonder, such as writing a Perl program a.pl and C + + program b.cc,
- Perl programs do not need to compile at all, directly run Perl a.pl,
- For C + + programs, you need to compile g++ a.cc, generate the executable a.out, and then run
- C + + is a static type of language resulting in the result that
- A C + + variable must first define a type, int, char, float, and then use the variable
- Perl and Python variables do not need to be defined before they can be used directly.
- The most important feature in C + + is: class
- The main purpose of C + + is to allow program apes to define their own types, and to make these types as easy to use as built-in types (int, float)
- C + + standard library, is a number of C + + experts, write some class types, these class type code is very sharp writing
- Therefore, we can summarize the learning route of C + +,
- The first is to learn basic grammar
- Then, learn to use the class type written by the master who wrote the standard library
- Then, learn how to write your own class type
- Therefore, the C + + primer This arrangement layout, is still very scientific.
Chapter II Variables and basic types (1)