oneConfiguring the Development Environment
First, download a good mingw file through a browser search or by sharing it with friends (the file should be placed in the root directory of drive C)Copy the code
Then go to the file bin and copy the file path
Exit to my computer, right click on properties, Advanced System Settings, and Environment Variables
Create or find Path and paste the copied Path
After completion, click confirm X3, and then open CMD command prompt and enter g++ –version. If the content or version information appears in the picture, it will prove that the installation is successful. If the preceding steps fail, you cannot perform subsequent operations
Second, the installationVisual Studio CodeAnd run debugging
Once you have Visual Studio Code installed in the App Marketplace,
Search and download ‘C/C++’, ‘Code Runner’, ‘Chinese’ in the Extended App Store
Click file in the upper left corner to create a new file and start editing
Let’s try the following code, copy and paste it into blank text
#include <stdio.h> int main(){ char name[100]; printf("What is your name? \n"); scanf("%s",name); printf("Hello,%s,nice to meet you! \n",name); }Copy the code
Then press The shortcut key Ctrl+S to save, add the suffix. CPP after the file name and save
Now that the text is in color, let’s click on the top right triangle icon to start runningSuccess!!
1. In programming, portability means that C programs written on one system can run on other systems with little or no modification
2. Source code files contain code written by programmers in any language. The object code file contains the machine language code and does not need to be the complete program code. The executable file contains all the machine language code that makes up the executable program.
3. Seven steps: Define the program’s goal — design the program — write the code — compile the program — run the program — test and debug the program — maintain and modify the program.
4. A compiler is a program that translates high-level language programs into machine-language instructions that a computer can understand. It is also a program that converts source code into executable code
5. The purpose of the linker is to connect the object code you write, the standard startup code of the system, and the object code of the library code into an executable program.