The 20 most basic rules of c ++

Source: Internet
Author: User

C ++It is a very advanced course. For Beginners, it is essential to master the basic rules at the initial learning stage. The following are the 20 most basic C ++ rules I have summarized.

1. All C ++ programs must have a main () function, which is the start of program execution.

2. All variables must be declared before use

3. C ++ supports many data types, including integer and floating point types.

4. The output operator is <, used with the cout statement to output information to the screen.

5. The input operator is>, used with the cin statement to read information from the keyboard

6. The program ends at the end of the main () function.

7. All functions are mutually independent entities. functions cannot be nested with each other, but they can be called with the exception of the main () function.

8. Function Representation: The function name is followed by parentheses.

9. Form of calling a function: first, the function name, followed by a pair of parentheses, and finally a semicolon

10. When a function requires a parameter, the parameter is placed in parentheses after the function name.

11. When you use a library function, you must include the header file of the function in the program, because the header file provides a library function prototype.

12. The actual parameter argument is the value passed to the function when calling the function. The form parameter) is a variable defined by the function to receive the actual parameter.

13. The term "actual parameters" in C ++ can also be referred to as parameters) refers to the value used to call the function, and the variable receiving these values is called a formal parameter. In fact, parameters with actual parameters are usually called parameterized functions)

14. Remember that void is used only when the function does not return a value.

15. The standard C ++ does not use the "Default Integer type". Therefore, you should specify the return value type for each function.

16. if select between two execution paths

17. ++ is the incremental increment) operator, which is used to add 1 to the operand; -- decrement) operator, which is used to reduce the operand by one

18. code blocks are logically related statement units. Using code blocks to implement algorithms can make the idea of algorithms clearer and more efficient.

19. We recommend that you use the indent orchestration format when writing a program: indent the code after the braces begin. After the braces are completed, the Code indent orchestration format is restored to the format before the braces begin.

20. Remember, the keyword size is meaningful. C ++ is a case-sensitive language that requires all keywords to be lowercase.

C ++ should be easy to learn, and should be gradual. For Beginners with no basic knowledge, it is necessary to calm down and avoid impatience. To become a master of C ++, it is not so easy. It must take a lot of effort.

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.