Learn C++ - "Hello World "

The C++ programming language was developed at AT&T  Bell laboratories in the Early 1980s by Bjarne Stroustrup. He  fond "C" lacking simulation and decided to extend the Language by adding features from Simula 67.

Since then C++ is most preferred High Level Language. Here we will  First of all make a Program that will Generate the Output "Hello World" on User Screen


We will be using Turbo C++ IDE, Here we'll assume that you have installed Turbo C++ 3.5  or version 4.0





Setting the Environment:
  1. Go to   Installed location , open "TC>Bin> TC.exe"
  2. TC will open up , click on Windows > Close All
  3. Go to File > New , do not save it.
  4. Now go to "DOS SHELL" , and make a folder to Save the File.
    Type "MD CPP" , then "CD CPP" , then "EXIT". Here a folder namely "CPP" will be created in your Bin Directory . You can Name it anything instead of CPP. From now onwards we will save all Program in this Directory
First Step : Adding Header Files
Header Files includes predefined function that a compiler will call while compiling the Program. The Basic Header file is iostream.h . It is the standard library which provide instruction to Implement input /output facilities.

Every Header file is included like this:
#include<iostream.h>

Second Step: Initialize main() Function
Every C++ function have " ()" bracket in the End and posses its code in { } bracket

Third Step: Write the Code

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"Hello World";
getch();
}

Explanation
  • Header File conio.h is used to implement  function clrscr() , which will clear all the previous cache of TC Compiler
  • cout and cin are basic I/O operators  , we use cout with "<<" to output Data and use cin with ">>" to give Data to a Program
  • getch()  function is used to get character from user . Here we used it , so that Program will not got closed till we input something.
  • Every Preprocessor like Header files are used in Program by using Preprocessor directive #include 
  • Every Code line Ends with  semicolon " ; ".