Thursday 4 July 2013

Simple Program of Math ic C++

Write a simple program of addition, subtraction, multiplication and division.....

#include<iostream.h>
#include<conio.h>
class math
{
    private :
        int a,b,add,sub,div,mul;
    public:
        void putdata()
        {
            cout<<"\n Enter value of a: ";
            cin>>a;
            cout<<"\n Enter value of b: ";
            cin>>b;
        }
        void process()
        {
            add=a+b;
            sub=a-b;
            div=a/b;
            mul=a*b;
        }
        void getdata()
        {
            cout<<"\n Addition is= "<<add;
            cout<<"\n Subtraction is= "<<sub;
            cout<<"\n Multiplication is= "<<mul;
            cout<<"\n Division is= "<<div;
        }
};
void main()
{
    clrscr();
    math m;
    m.putdata();
    m.process();
    m.getdata();
    getch();
}


Here is the output :->

No comments:

Post a Comment