There is no similarity between integers and floating-point numbers (150 and 150.0 are very different), and it is inefficient to use a double when it is not necessary.
Integers: Usually in twos complement form
Floating point number: symbol bit + Power + mantissa (used to indicate that a large integer may have rounding errors.) c++0x large integers available long long int)
# # # #rule: The computer can only perform absolutely clear instructions # # //it: Limited by CPU instruction set
AI: Countless simple and clear small judgments make up complex programs
# # # #c A statement can be used anywhere in the sentence (statement block) # # # #/Statement block does not need to end with a semicolon, can be 0 statements
Most expressions (including assignments) in C + + generate a value (the void function is an exception) and can therefore be x=y=z=0; This assigns a value.
C + + programming style: Lowercase letters as variable names.
BOOL Type: TRUE (1) and False (0) are predefined constants of C + +.
Self-increment self-reduction: var++ The first value and then self-increment, the ++var first self-increment and then transmit the value.
Expressions: Use C + + Chinese operators to concatenate variables, constants, and smaller expressions into a value (usually resulting in a value).
Any expression plus a semicolon is a statement (3; also). One line can write multiple statements but is not recommended.
Operator: Arithmetic above relationship is higher than logic. And && is a short-circuit operation. Bitwise operators (& |! ^ ~) is an operation bits, without the use of short-circuit logic.
#include <cmath>
Double x = sqrt (2); Ok,int will be automatically turned into double
int y = sqrt (2); Warning, decimals will be discarded.
Summary trap:
Any value with a decimal point will be recognized as a floating point value.
Statement BLOCK: 0 or more statements in curly braces.
"Studious C + + 2nd Edition" 2nd Chapter judge, then judge