Before starting the basic of C++ language, let us give you a basic idea pf a c++ program.

To write the first C++ program, open the C++ console and write the following code:

#include<iostream>  

void main() {  

   clrscr();  

   cout << “Welcome to C++ Programming.”;   

   getch();  

Now we will discuss each and every word of the above program in detail,

#include includes the standard input output library functions. It provides cin and cout methods for reading from input and writing to output respectively.

#include  includes the console input output library functions. The getch() function is defined in conio.h file.

void main() The main() function is the entry point of every program in C++ language. The void keyword specifies that it returns no value.

cout << “Welcome to C++ Programming.” iused to print the data “Welcome to C++ Programming.” on the console.

getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.

;{} ; is used for terminating the line so that compiler came to know that the line has been completed and {} are used for telling the compiler that statements in between these bracket belongs to some function

If you are using any other compiler instead of turbo C++,it may give you an error,for removing that error you need to add one more line using namespace std;

and now program will look like

#include<iostream> 
using namespace std;

int main() 
{
    cout << "Hello, World!";
    return 0;
}

please don’t get confused if any confusion is there you are free to contact us

How to compile and run the C++ program

There are 2 ways to compile and run the C++ program, by menu and by shortcut.

By menu

Click on the compile menu then compile sub menu to compile the c++ program.

Then click on the run menu then run sub menu to run the c++ program.

By shortcut

Or, press ctrl+f9 keys compile and run the program directly.

You will see the following output on user screen.

Hello world

You can view the user screen any time by pressing the alt+f5 keys.

Now press Esc to return to the turbo c++ console.