C ++ primer Study Notes (1): Basic Language

Source: Internet
Author: User

Source: C ++ primer P1 ~ P49
Level: 100

 

 

STD: Endl
Note: The effect is not only a line break, but also a buffer refresh for immediate display of results.
In the debug process, the log should use the Endl to refresh the buffer for each sentence, so as to avoid the loss of the buffer information caused by crashes and cause debugging misleading.

 

 

Enter Ctrl + Z in the MS-DOS window to enter the file Terminator
Note: In some short small test programs, the while (STD: CIN> value) is often used to obtain the input. Pressing the carriage return will not cause the exit loop, press Ctrl + Z to achieve the goal.

 

 

True and false
Note: any non-0 value indicates true. The value 0 indicates false, and the value-1 indicates true.

 

 

L 'A' and l "ABC"
Note: You can add L before the character (string) to obtain the wide character (string) literal of the wchar_t type.

 

 

STD: cout <"AB" L "cd" <STD: Endl;
Note: the result of connecting string literal and wide string literal is undefined.

 

 

Int I (100); and INT I = 100;
Note: The above is direct initialization, and the following is replication initialization.
More flexible direct initialization (multiple parameters), more efficient (less than once ).

 

 

Built-in Automatic Initialization
Note: If the built-in type is defined outside the function, it is automatically initialized to 0. The definition in the function body is not automatically initialized.
Variable definitions in the function body should be manually initialized.

 

 

Automatic class initialization
Note: The default constructor is called no matter whether it is defined inside or outside the function.

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.