Welcome to the World of C++

Get started

In order to use C++, you need to have an advanced text editor and a compiler. In this tutorial, we will use Visual Studio Code and G++.

Installation of VS Code can be found at https://code.visualstudio.com/Download. Installation procedure for G++ is at https://code.visualstudio.com/docs/cpp/config-mingw if you are on Windows, https://code.visualstudio.com/docs/cpp/config-linux if you are on Linux, and please use Clang++ if you are on MacOS.

After you open VS Code, the following will show up:

Click on "open folder", select a folder, and this will show:

Hover over this bar con the "C++ TUTORIAL"(or your folder name) area, and you should see a few icons, the leftmost is the "New file" icon, click on this icon, name your file "hello.cpp", and paste in the following code:


                  #include<iostream>
                    using namespace std;
                    int main(){
                        cout<<"Hello world!"<<endl;
                        return 0;
                    }
                

Now, there is a triangle with a bug at the top-right corner, click on the down arrow at the right of this icon, and select "Run C/C++ File", then select your compiler.

The bottom area of the code editor, the terminal, should now show the following content:

Navigate to "Terminal", and the output of the program should be shown:

Hello World!

Congrats! You have now created you first program!

Now head to the Next Page to learn how this program works.