A Child’s C++ Diary at Age 8: (2) Code Framework

C++Code Framework

The code framework: Speaking ofC++, it has a dedicated framework to contain it, which is essentially a small box that holds the code. So what does theC++ code framework look like? (Below is)

#include <iostream> // Export toolbox
using namespace std;  // Namespace
int main(){           // Main function
    return 0;  // End statement
}

How to write code:

When programming, write the code between the main function and the end statement.

Meaning of the framework:

So what does this framework mean?

Let’s take a look together

Line 1:

Export a toolbox. Speaking ofC++’s toolbox, it has many, such as:iostream,cstdio etc.

Line 2:

Exporting a namespace, what does exporting a namespace mean? In simple terms, it means exporting a naming space.

Line 3:

The third line is the main function, which is the main function that starts the program. What is a function? We will discuss it later.

Line 4:

return 0; indicates the end of the program

Exercises for this lesson

1. What does include mean? ()

A、Add B、Include C、Export

2. Is it correct to write code after return 0; ( )?

A、√ B×C、Both are possible

3. iostream is a ( )

A、Box B、Toolbox C、None of the above

4. What does namespace mean ( )

A、Space B、Naming space C、Toolbox

5. What is the function discussed in this lesson ( )

A、Not discussed B、main C、Can’t say

6. The line used to start the program is ( )

A1 B4 C3

Leave a Comment