“Hello World!” C++ 1st Program

Hello world! in c++ is the 1st program to write in compiler. Most of developers start learning development with this program. Hello World! is the simplest program in c++ where we just need to print a line “Hello World!”. In this article, we will start to learn basic structure and wat of coding in C++.

Code of C++ Hello World! and it’s structure

// Our 1st C++ Program

#include <iostream>
using namespace std; 

int main() {
    cout << "Hello World!";
    return 0;

Structure of C++ Program


Every line starts with // is called a comment. Comments are used to remember that why we write these lines of code. In start, we will write some short codes where you can remember everything. But when code will exceed over 500 lines, it will hard to remember.

#include in C++

#include is used to add any libraries which will be used later. Here we are including IOSTREAM which is basic library of C++. Without this library, we will not be able to compile or run this code to check output.

int main() in C++

int main() is the main function of C++ where the compiler starts to execute the code. 1st line in int main() will be executed 1st.

cout in C++

We use cout << in c++ to print any statement. It can be a string, integer number, float number, and any boolean value. In our 1st program, we are printing “Hello World!”. Every alphabets in quotes ” ” as string. Every value in quotes will be printed as it is.

return 0 in C++

return 0; in C++ is basically an exit statement of any c++ program. This line will tell the complier that you need to end this program here. After this line, if you need to run your program again, you will compile or run the whole program again.


We have discussed almost every single point of 1st program in c++. if you have any query or question, you can just comment here. You can download dev C++ from here.

1 thought on ““Hello World!” C++ 1st Program”

Leave a Comment