Some details about C ++ [One]

xiaoxiao2021-03-05  26

I. Overview:

B.S .--- Real programming is more important than pure principles!

Data algorithm = program;

General programming: GP emphasis algorithm; OOP emphasizes data

Portability and criteria: Place part of the hardware is placed in the function module.

........

Two .c programming

1. About header files iostream

New compiler use:

#include

Using namespace std;

Old compiler is required:

#include

/ / Do not need Namespace STD

** C Preprocessors The compilation instructions beginning with #nclude will make the contents of the iostream file to the compiler with the source code file content, which make up a composite file for compiler processing.

** Using Namespace Std; makes all names in the STD name space available, such as the I / O: COUT, CIN ... class, functions of this example, variables are standard components of the C compiler, put in the namespace STD ((When not used. Hy-like header file)

2.c can use printf (), scanf () ... standard C I / O function, only need to include header file

3. Function head int main ()

Variant Int Main (Void)

Main () // C style

Void main () // cannot work on some systems

4. Return 0; implied meaning: already arrived at the main () function tail

5. Use COUT for C output

A predefined object when cout (the object is a specific instance of the class)

6. Statement statements and variables

Indicates the storage location (name representation) of the information and the required memory space (type to determine)

7. You can use the assignment operator as: int a = b = c = 3; assign values ​​from right to left

8. Splice version of COUT. // More benefits

EG: COUT << "Hello"

<< Yourname

<< "Welcome to my blog!" << Endl

9. Provide prototypes for each function used in the program

// The compiler tends to add a downline prefix to the function name, prompting them to have the final say of the program.

10. Return value function

Return 14 * n; // Version 1

INT A = 14 * n; // Version 2 is slightly longer than the time of Version 1, but the format is good, it is not easy to go wrong.

Return A;

/ ******** Attached: The above is only based on my personal situation, some of the previous unclear knowledge points. May have some errors or very unharequently, welcome to "C enthusiasts" to exchange ******* /

转载请注明原文地址:https://www.9cbs.com/read-35359.html

New Post(0)