Visual Studio 2019 creates a C language console project

Visual Studio 2019 create a C language console project

1 create project

1.1 Choose to use content features

① After opening the software, come to the start page interface, click [Create New Project]

 image.png

1.2 Fill in project information

① Language selection【C++

② Platform selection【Windows

③ Project type selection [Control Panel]

④ Select [Empty Project]

⑤ Click [Next (N) ]

 image.png

1.3 Configure a new project

① Name the project

② Click Browse and select the location where the project is stored

③ Click [Create (C) ]

 image.png

2 Create a source file

2.1 Open the Solution Explorer

Note: If the page already displays the Solution Explorer , this step can be omitted

① Click [View (V) ]

② Click [Solution Explorer (P) ]

 image.png

2.2 New construction items

Description: There are many kinds of items, including source files, header files, etc.

① Right click [source file]

② Click [Add (D) ]

③ Click [New Item (W) ]

 image.png

2.3 Add source files

Note: The location of the source file does not need to be moved, as shown in the figure below.

① Select【Visual C++

② Select [ C++ file (.cpp) ]

③ Modify the name, note that the suffix name is changed to .c

④ Click [Add (A) ]

 image.png

3 write programs

3.1 Write a program

①Double -click [ main.c ] to write the following program:

#include <stdio.h>
int main ()
{
    printf("Hello World!\n");
    return 0;
}

image.png


3.2 Compile and run the program

Note: After writing the program, you can directly press Ctrl+F5 to compile and run the program directly

① Click [Debug (D) ]

② Click [Start execution ( no debugging ) (H) ]

 image.png

The running result is shown in the figure below

image.png

 


Guess you like

Origin blog.51cto.com/15066242/2574457