Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Temp{
- public:
- int add(int num1, int num2)
- {
- return num1+num2;
- }
- int subtract(int num1, int num2)
- {
- return num1-num2;
- }
- int divide(int num1, int num2)
- {
- return num1/num2;
- }
- int multiply(int num1, int num2)
- {
- return num1*num2;
- }
- int modulus(int num1, int num2)
- {
- return num1%num2;
- }
- };
- int main()
- {
- int num1, num2;
- class Temp t;
- cout << "Enter Operand 1 : ";
- cin >> num1;
- cout << "Enter Operand 2 : ";
- cin >> num2;
- int r1=t.add(num1,num2);
- int r2=t.subtract(num1,num2);
- int r3=t.multiply(num1,num2);
- int r4=t.divide(num1,num2);
- int r5=t.modulus(num1,num2);
- cout<<"the addition of these no gives:"<<r1<<endl;
- cout<<"the subtraction of these no gives:"<<r2<<endl;
- cout<<"the multiply of these no gives:"<<r3<<endl;
- cout<<"the divison of these no gives:"<<r4<<endl;
- cout<<"the modulus of these no gives:"<<r5<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement