<>Visual Studio2019 Novice C++ course ( One )


Starting from this lesson, each lesson will teach a simple lesson in great detail C++ program , I'll take it as an example Visual
Studio2019( Now the latest version ) take as an example ( Can not download Baidu ). Now I am a junior one student , If there is something wrong, please point it out .

I believe that the first program of a general programmer is Hello World, So we also start with printing Hello World Let's go !

1. Open it first Visual Studio.

2. Open and choose to continue without code .

3. Open and select the file -> newly build -> project .

4. Next, choose C++ Empty project .

5. Enter project name ( It can be written here Hello World) And the location to save .

6. Next, in the Solution Explorer Right click the source file Select Add New item ( If there is no solution, please see the appendix 1).

7. Then select C++ file , You can modify the file name yourself .

8. Write code .

The source code is as follows :
#include<iostream> using namespace std; int main() { cout << "Hello World!";
return 0; }
Let's talk about the code
among :
This is the introduction of a C++ A header file for input and output streams in , It's almost impossible C++ Required header file in .

using namespace std;
This is the reference standard's namespace , It's because it's used below cout.
You can use a code instead :
#include<iostream> int main() { std::cout << "Hello World"; return 0; }
This needs to be added every time std::

int main() { }
This is the main function , Every program must be written , Programs are executed from the main function .

cout<<"Hello Wrold";
This is printing Hello World.
You can also use the following code instead :
#include<iostream> using namespace std; int main() { printf( "Hello World");
return 0; }
perhaps :
#include<iostream> using namespace std; int main() { puts( "Hello World");
return 0; }
puts It's line wrapping , and cout and printf No word wrap .

Of course, there are many different ways to write it , I won't introduce it here .

last : return 0;
This is the normal end of the program .

After explaining the program, start compiling and running !
9. You can click start ( No debugging )

You can also click local Windows debugger :

Finally, the running results :

appendix 1:
There is no open view for Solution Explorer , Solution Explorer :

This is my first post , After that, I will write the following courses slowly !

©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition