You are on page 1of 1

#include <iostream>

using namespace std;


int a;
/* run this program using the console pauser or add your own getch, system("pause")
or input loop */
class calculator{// private; public;
private:
int x;
int y;
public:
calculator()
{
x=0;
y=0;
}
void insert()
{
cout<<"Default value of x:"<<x<<endl;
cout<<"Default value of y:"<<x<<endl;
cout<<"Enter value of x:";
cin>>x;
cout<<"New value of x:"<<x<<endl;
}
void add()
{
cout<<"add:";
cout<<x+y<<endl;
}
void addage()
{
cout<<"sub:";
cout<<x-y<<endl;
}
void mul()
{
cout<<"MUL:";
cout<<x*y<<endl;
}
void div()
{
cout<<"div:";
cout<<x/y<<endl;
}

};

int main() {
calculator s1;
s1.insert();
s1.mul();
s1.addage();
s1.div();
s1.add();

return 0;
}

You might also like