Hello world program in cpp

The first program in cpp is printing the hello world to the output screen (hello world program in cpp).

Hello world program in cpp is the most simple and basic program to print hello world in cpp.

For printing the hello world we should clear of the following cpp topic :

Cpp Input and output

If you know the basic input and output concept it’s enough to write the hello world program in cpp.
Now let’s see the algorithm and program for hello world program in cpp.

Algorithm to print hello world

hello world in cpp

1. Start
2. Include standard input and output directories.
3. Print hello world using standard output function.
4. Return from the function.
5. End.

Hello world program in cpp

12345678910#include <iostream>using namespace std;int main(){    cout<<“hello world”;    return 0;}


Hello world program in c


1. In starting the program first we start with including the standard libraries (preprocessor commands). This command tells the compiler to include the iostream header file. The compiler includes the functions in iostream header file in the program. The iostream  contains input and output such as cin and cout. Using the cout in the program without standard library file will give the compile time error.

2. Now we write the main() function, the execution of the program starts with the main().

3. Next, we write cout , the cout  is a object of output stream in standard io which is used to send the formatted stream(data) to the output screen. So using cout and << to extract output to screen we print hello world.
In this program, the compiler reads the line cout<<“hello world”; and writes a string in double quotes to the screen.

4. At the ends as main returns anything (as we written int as a return type of main), we return 0 (successful execution termination ) and return from the program.

5. Now we will see hello world printed to the output screen.