Programming

“HELLO WORLD!” Program in C++

hw proteach 2

“HELLO WORLD!”

Program in C++

 

The first program in every programmer’s life is to print “HELLO WORLD!” on the console.

This “HELLO WORLD!” program is the most simplest program but has a lot of impact on a new programmer.

This program is often used teach the main syntax of the programming language.

 

Hello world program 1

 

OUTPUT

output PROTEACH

In this “HELLO WORLD!” Program there are many things we need to understand so we take a look at this program briefly. We will talk about the code line by line.

 

#INCLUDE

It means that we want to include some Library or some file which carries some function or some programs which we are including in this program we are about to write.

<IOSTREAM>

IOSTREAM is a library which carries function or programs which we can use in our program we are making. The IOSTREAM contains compiler made function which we use in our program.

Using namespace std

All the C++ libraries are declared with standard which is known as namespace. We can write the std with the code line as given in the EXAMPLE 2 of this same code. But it is better to write std up so we don’t have to write it again and again.

Int Main ()

Int main is a main body of our program in which we write our code to make our program. Every program in C++ consists of main program.

Int is the return value of the program main shall return an integer value before terminating itself.

Return 0

Return 0 means that main is returning 0 integer value. Return 0 causes the main function to terminate. Whenever you write a return statement in any of your function that function terminates itself returning the value given after return. It can be any value of the corresponding function you are making. It can be integer or character or double or float or anything you defined your function with or nothing.

cout << “HELLO WORLD!” ;

In this cout is the IOSTREAM LIBRARY OUTPUT function operator (PRINTING FUNCTION OPERATOR) which is self defined by the compiler LIBRARY itself.

The 2 less than signs means that we are going to output or print something on the console.

The “…” means that anything we have to just print on the screen or console we have to write between these “…”.

HELLO WORLD! Is a simple text we have written which we have to print on the console.

{}

These are two curly brackets we write one at the start of the function and one at the end to indicate the start and the end of the respected function.

;

Semi-colon is the most important syntax in the C++ Every CODE line we write we have to close that code line with a semi-colon.

EXAMPLE 2: 

HELLO WORLD PROTEACH p2

OUTPUT

Check out our latest articles.

output PROTEACH

36 Comments

36 Comments

  1. Pingback: Input and Output Operators In C++ – Pro Teach Articles

Leave a Reply

Your email address will not be published.

Most Popular

To Top