Li Yuan -20181003114- algorithm first chapter Assignment 3

C ++ code specification -2019-08-29

Reference: https://blog.csdn.net/csdn_baotai/article/details/80304636

1.“{ }”:

  1.1 For other statements if certain conditions can be written in curly brackets omitted, although the program is still executable, but also to look at other people write the code, so the statement for each paragraph, all with replacement brackets;

  1.2 All statements in braces are required to have a tab indented to show hierarchy;

2. The functions, variables, named:

  2.1 underlined, numbers, letters (not begin to digital);

  2.2 is not available with reserved words of the same name;

  2.3 Named as simple, understandable and meaningful;

  2.4 is best to use English to name some specific variable names need, function name, and a small hump nomenclature references (that is, except the first word of the first letter of each word capitalized rest, such as: isAlpha ());

3. Note: Each write a function, class, should be the first to write a comment to tell others of the function, the class action;

  3.1 For the function difficult to understand local and global variables, and should have the appropriate comments to help others understand;

4. Multi-file:

  4.1 should be more complex to write a separate program, the function is about to write another file, then it can be introduced;

5. Wrap:

  5.1 Each finished a sentence to wrap;

  5.2 If the sentence is too long (greater than about 80), also need wrap, in order to read;

6. Some syntax:

  6.1.if statement else,else if() on a separate line;

  6.2. switch Statement segmented braces may be used to indicate not connected together between the case.

7. pointer:

  7.1. Do not have spaces before and after the dot or arrow.

  7.2. No spaces after the pointer / address operator (), *, &;

8. Return Value:

  8.1 For each function, regardless of the return value is null, also need to write a return statement;

9. categories:

  9.1 access control statement block in descending order are public, protected, private, and each indented one space;

10. Operator:

  10.1 spaces before and after the operator has to be separated;

Guess you like

Origin www.cnblogs.com/liyuan1/p/11431865.html