C++

C++ Hello world program explanation

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

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++

Program

Out put

Hello world

Related post

Hello world in java

Hello world in C

Hello world in Python

 

Karmehavannan

Recent Posts

Subtract two numbers using method overriding

Subtract two numbers using method overriding   Program 1

3 months ago

PHP Star triangle Pattern program

PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…

3 months ago

Using function or method to Write temperature conversion : Fahrenheit into Celsius

Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…

1 year ago

Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user

Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…

1 year ago

Write temperature conversion program: Fahrenheit into Celsius

Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…

1 year ago

How to write a program to convert Fahrenheit into Celsius

How to write a program to convert Fahrenheit into Celsius In this article, we will…

1 year ago

This website uses cookies.