Joke Collection Website - Bulletin headlines - Language standard slogan

Language standard slogan

1 and () have no spaces on either side.

Example: if (a = = 1)

2. If for while is connected with brackets, there must be a space in the middle (1).

Example: if (a = = 1)

There must be a space between 3, () and ".

Example: int add (a, b)

4. There is a space between the function return type and the function name instead of TAB.

Example: int add (a, b)

5. There is no space between the function name and the following brackets.

Example: int add (a, b)

6. The left parenthesis of the function must be on the next line and cannot follow the right parenthesis of the function.

Example: int add (a, b)

{

}

7. Type pointer symbol or variable name with address symbol, type+symbol+space+variable name.

Example: int* nCount

8. When initializing the variable definition at the same time, the left side of the equal sign is Tab and the right side is space.

For example: int nbuf =10;

9. The left brace followed by if for while else needs to be placed in the previous line.

Example: if (npatrol point-1

nPatrolPointId = 1;

baHead = TRUE

}

10, if the for while else execution code has only one line, the brackets can be omitted, but there must be a blank line after it.

Example: If (a! = 0)

Return;

If (...)

....

1 1, the comment is//

Example://Fill in the comments here

12. You need to output a comment prompt message during code compilation.

Example: # pragmamessage (_ txremind ("Use this example like this." ))

13 and if for while else () have operations above 1, and only the last operator has spaces on both sides.

Example: if (a-b >; c+d)

14, public: No blank line is required, and the following line is directly followed by the statement. There is no blank line in the statement, and a blank line is required at the end.

15, header file #include "..." must be empty after the end.

16. There must be a blank line of 1 between #endif in the header file.

17, if you can't go with the return.

Example: if (a) returns b; //Error

If (a)

Return to b;

18, 16 In the code, the x written is lowercase, not uppercase.

For example: 0x000000 1 is correct.

0X0000000 1 is not standard.

When 19 and const are placed after ")", spaces need to be added between them.

20 、# ifndef+" Tab "+" _ "+" _ "+NAME+" _ "+H+" _ "+" _ "

#ifndef is followed by a tab, then two underscores, then NAME, then 1 underscores, then h, and finally two underscores.

Example: # ifndef _ _ global _ h _ _

# define _ _ GLOBAL _ H _ _

# endif _ _ GLOBAL _ H _ _

2 1 、#pragma region RegionName

# pragmaendregion has a space in the middle.

1. After calling a function to get a pointer to an object, first judge whether the pointer is obtained;

2. the name of char * should be preceded by lpsz.

3. The name of 3.std::string should start with s;

4. the name of int * should be preceded by lpn;;

5. If char* is to be left blank, it should be null, for example, char * a = null.

6. Standardize the writing of judgments in functions.

Adopt:

If (a & gt0) {

a = 0;

} Otherwise {

a = 1;

}

Do not use:

If (a>0)

{

a = 0;

}

other

{

a = 1;

}