Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Temp{
  6.     public:
  7.     int add(int num1, int num2)
  8.     {
  9.       return num1+num2;
  10.     }
  11.     int subtract(int num1, int num2)
  12.     {
  13.       return num1-num2;
  14.     }
  15.     int divide(int num1, int num2)
  16.     {
  17.       return num1/num2;
  18.     }
  19.     int multiply(int num1, int num2)
  20.     {
  21.     return num1*num2;
  22.     }
  23.     int modulus(int num1, int num2)
  24.     {
  25.     return num1%num2;
  26.     }
  27. };
  28. int main()
  29. {
  30.     int num1, num2;
  31.     class Temp t;
  32.     cout << "Enter Operand 1 : ";
  33.     cin >> num1;
  34.     cout << "Enter Operand 2 : ";
  35.     cin >> num2;
  36.     int r1=t.add(num1,num2);
  37.     int r2=t.subtract(num1,num2);
  38.     int r3=t.multiply(num1,num2);
  39.     int r4=t.divide(num1,num2);
  40.     int r5=t.modulus(num1,num2);
  41.     cout<<"the addition of these no gives:"<<r1<<endl;
  42.     cout<<"the subtraction of these no gives:"<<r2<<endl;
  43.     cout<<"the multiply of these no gives:"<<r3<<endl;
  44.     cout<<"the divison of these no gives:"<<r4<<endl;
  45.     cout<<"the modulus of these no gives:"<<r5<<endl;
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement