January 29, 2013

Structure of C++ (OOPs) Program


actual structure of C++ (OOPs) programming language with proper explanation


DOCUMENTATION SECTION

It consists of set of comments giving the name of the program, the inputs required by the program and output will be generated by computer. It can also contain other information about program such as programmer name, date, place, time of creation etc.

LINK SECTION

It provided instruction to the computer to link with various header files. The header file is a file that contains various inbuilt functions that can be used in the program.

DEFINITION SECTION

It defines different symbolic constants that are used in the whole program again and again.

CLASS DEFINITION SECTION

In this section it tells how classes are made for their respective purpose, to decrease the time of execution and length of the program.

CLASS FUNCTION DEFINITION SECTION

In this section it tells you how function is made inside the class.

MAIN FUNCTION

Every C++ program contains one main function. Declaration which consists of definition of all the variables and the executable part which contains various statements which are to be executed. The only variation from C language is that if a class is made in C++ program then object must be required to execute the class.


Difference between C and C++ Language

theoretical difference between C and C++ (OOPs) programming language

practical difference between C and C++ (OOPs) programming language

If you are unable to read C++ code which is mentioned then you can find it over here:

#include<iostream.h>
#include<conio.h>
class operation
{
      public:
      int sum,mul;
      void add(int a,int b)
      {
              sum=a+b;
              cout<<"\nSum of two numbers is "<<sum;
              }
      void mult(int a,int b)
      {
              mul=a*b;
              cout<<"\nMultiplication of two number is "<<mul;
              }
};
main()
{
      class operation o;
      int a,b;
      cout<<"\nEnter any two numbers\n";
      cin>>a>>b;
      o.add(a,b);
      o.mult(a,b);
      getch();
      }
output of addition and multiplication operation using C++ (OOPs) programming code



2 comments: