"Studious C + + 2nd Edition" 2nd Chapter judge, then judge

Source: Internet
Author: User
Tags bitwise operators



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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.