The storage, representation and basic arithmetic of-----data program in C + + basic knowledge learning

Source: Internet
Author: User

Just started to learn C + +, reading summed up a little note, one record down for easy follow-up review, and I hope I can be the same little white a little help

Storage, representation and basic operation of data programs

1.1/1.2 (chapter of the book)
{
1. Separate the contents of the input with a space

2. The Declaration of a function is similar to a name, and it is only necessary to write the function in the main function before the function call in the main function to declare

3.c++ output format:cout<< output content <<endl; input format:cin>> input content;

4. The main function is generally defined as type int: Yes returns 1, otherwise returns 0;

5. The name of the namespace cannot be duplicated;

6. Variables, functions in different names can have the same name, call format b::fun ()//define namespace B namespace B;

7.string Type: Initialization of String type: 1.string s1; S1 is an empty string S2 ("ABC"); Initializes s2string S3 (S2) with string values; Initialize the S3 to a copy of S2 string S4 (N, ' C '); Initialize the S4 to n ' C ';
Action: 1.s.empty () returns TRUE if S is null, otherwise returns FALSE, 2.s.size () returns the number of characters in the string, 3.s[n] returns the nth character in the string, starting with 0, 4.s1+s2 joins the S1,S2 and returns the new value; s1= S2 replaces the value of S1 with S2; V1==v2 determines that it returns true, otherwise it returns false;
s5= "Hello" + "world" is illegal;
}
1.3
{
1. Single-line comment is//comment content; Multiline comment */* Comment content */

2. A function includes 1. preprocessing commands, 2. Global declaration section, 3. function; cout1.txt

3. The end of the output statement must have Endl;

The data type bool (true; false) that is specifically used in 4.c++;

5. How to represent floating-point numbers:
(1). Decimal: Generally by default double-precision processing, after the data plus F is a single precision (four bytes), after the data is added l/l to double precision (eight bytes)
(2). Exponential form: E12 represents ten of the 12-time Square

6. Escape character: \a bell; \ n newline; \ t horizontal tabulation (jumps to the next tab position ...) \b Backspace; \ r Enter; \f, \v vertical tab; \ \ backslash \
\ ' single quote character; \ ' double-quote character; \ddd character; the characters represented by the octal number of the decimal place; The character represented by the hexadecimal number of \xhh;

7. The identifier must be a letter, underscore, number, and the first character must be a letter and an underscore;

8.c++ defines the variables used: defined first, then used, and must indicate the data type, the variable must be initialized;

9. Before the defined variable is const, the value of the variable cannot be changed during the program's operation (also known as a constant variable), but the constant variable must be assigned at the same time as the definition;

10. Operator:% is divisible by the remainder;! = is not equal to;& fetch address operator; sizeof number of bytes operator

11. In C + + operation, all float types are processed by double type;

12. Coercion type conversion: (double) A converts a to a double type, (int) (X+Y) Converts the value of the x+y to an integer type;
The form is: typically (type name) (expression) new type name (expression) in C + +

13. The comma operator: The general form: expression 1, Expression 2, the solution is to find the expression 1, then the expression 2, the entire comma expression value is the value of the expression 2; In most cases, the purpose of the comma expression is to get the value of each expression separately, instead of using or getting the final value of the comma-expression

The storage, representation and basic arithmetic of-----data program in C + + basic knowledge learning

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.