You are here:   HomeC++ ProgrammingObject-oriented (OOP)Basic Structure of A Complete C++ Program With Classes
by Dinesh Thakur Category: Object-oriented programming (OOP)

 

#include<iostream.h>

#include<conio.h>
void main()
{
          clrscr();
          int a,b;
          cout <<"Welcome To C++ Language ";
          getch();
}

Simple C++ Program

1) In This #include is the preprocessor directive that is given by the c++ language it denotes to include the header file iostream.h means to include all the functions of the input output Stream header file which contains all the input and output functions like cout and cin all these are contained in it.

2) The Second Header file is used for using the getch and clrscr() functions

3) void main()

In this void means no Returnment of any value means a void doesn’t return any value it just performs the executions of the program one by one

4) Main() : - The () braces are the symbol of a function every function has braces In this Main () function has a main Role because the Execution of all the programs are started from the Main () function This is also known as the starting point of the program It executes the Statements as they are in The Main() function and in the block means in the open curly braces { and the closed curly braces }

 

{

}

These are used for denoting a block of statements those are to be executed

5) Clrscr() This is the built in function that is provided by c++  for removing the Results of the Previous Program which is made by any user. So when a user will execute his Program then this will first Clear the Contents of the Screen.

6) Conio header file this function is used for clear the contents of the screen

7) getch()

This is the function that is used for accepting a character from the user or it waits for a character from the user when a user press any character like a b c anything then it will go to the program So the main thing is here is that the getch function is used for accepting and for waiting a character from the user

 



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Popular Article