Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

C++ Hello world program explanation

Posted on November 5, 2017September 22, 2019

C++ Hello world program explanation

In this tutorial, we will learn about the simple concept in C++ Hello world program.

We start the C++ tutorial series with one of the simplest programs. This is a program that is easy to understand for beginners learning about c++ language. This program is called the Hello world program. When we execute the program, the message “hello world” is displayed on the screen.

This program contains all of the basic components of every C++ programs

  • Header file
  • Namespace
  • Main function
  • Print statement
  • Return statement

We will execute the C++ codes using code:: block ( How to Download and Install) IDE

C++ Hello world program explanation
Program

Out put

Hello world

Here, we try to understand every line in the C++ program

1. #include <iostream> – This is the header file in C++ Language. This header file starts with cash (#)symbol as used by the compilers pre-processor. That means basic standed input-output library files are included in this header file that is called as the preprocessor.

2. int main() – This is the main method in C++ programming language. It has two components. One of the component is int.

 – int –  In this case, int is called a return type

– main() – Every C++ program must have a main() function. The main function is the starting point of every program. That means all the C++ program start their execution here. The word “main” is followed by pair of round brackets to be able to  pass parameter in possible time.

{} – Two curly brackets. One indicates the starting point of function and the other indicates the ending point the function- This area is known as body of the function.

count<<“Hello world”; – This is a statement in c++, which displays “hello world” on the screen. count represents the standard output stream in C++

return 0; This is a statement in C++ language. This statement is used to return a value from the function and indicate the ending point of the function.

Every statement must end in semicolon in C++ language.

Hello world program using class in C++

C++ Hello world program explanation
Program

Out put

Hello world

Related post

Hello world in java

Hello world in C

Hello world in Python

 

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes