This is How You can Write a C++ Program to Print Hello World!

This is one of the simplest programs you can write on C++, here you will learn how to write a c++ program to print hello world!;

Note: For C/C++ coding, we’are using, NetBeans;

You can download NetBeans from here: Download NetBeans; and regarding compiler we’ve been using, you can download the setup file from the above link and do the necessary;

Learn: How to Find Area of Circle using Constant

Write a C++ Program to Print Hello World!

#include <iostream>
using namespace std;

int main(){

cout<<"Hello, World!";

return 0;


Hello, World!
RUN SUCCESSFUL (total time: 223ms)

Above code explained

iostream stands for Input Output Stream. It is basically a header file in c++ standard library.If you want to add streams in your program you need to include it. It provides basic input and output services for C++ programs.

A symbol may be for instance a function, class or a variable. E.g. if you add using namespace std; you can write just cout instead of std::cout when calling the operator cout defined in the namespace std

int main () with {} brackets is the (main) function where you will write the main code and while running the programming it will help you execute.

The cout object in C++ is an object of class ostream. It is used to display the output to the standard output device i.e. monitor. It is associated with the standard C output stream stdout.

Return 0 in C++ or C is the main function is of type int and therefore it should return an integer value. The return value of the main function is considered the “Exit Status” of the application. On most operating systems returning 0 is a success status like saying “The program worked fine”.

That’s it

Comment down if you ever get confused;


Crazy Coder

Writing Codes for Good <3

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *