Hello World Program in C++


A "Hello, World!" is a simple program that outputs Hello, World! on the screen. Since it's a very simple program

  • The program starts with the line #include<iostream> which is a preprocessor directive that tells the compiler to include the standard input/output library that provides functions to read from and write to the console.
  • The line using namespace std; is a using declaration that allows us to use the standard namespace in our code. This means that we can use functions and objects from the standard library without having to prefix them with std::.
  • The int main() function is the starting point of every C++ program. It returns an integer value to the operating system when the program terminates. In this case, it returns 0 which indicates that the program terminated successfully.
  • The line cout<<"Hello World!"; uses the cout object from the standard library to write the message "Hello World!" to the console.
  • Finally, the program ends with the return 0; statement which returns 0 to the operating system.

Source Code

#include<iostream>
using namespace std;
int main()
{
	cout<<"Hello World!";
	return 0;
}   
To download raw file Click Here

Output

Hello World

Program List


Flow Control

IF Statement Examples


Switch Case


Goto Statement


Break and Continue


While Loop


Do While Loop


For Loop


Friend Function in C++


String Examples


Array Examples


Structure Examples


Structure & Pointer Examples


Structure & Functions Examples


Enumeration Examples


Template Examples


Functions


Inheritance Examples

Hierarchical Inheritance


Hybrid Inheritance


Multilevel Inheritance


Multiple Inheritance


Single Level Inheritance


Class and Objects

Constructor Example


Destructor Example


Operator Overloading Example


Operator and Function Example


List of Programs


Pointer Examples


Memory Management Examples


Pointers and Arrays


Virtual Function Examples