Advertisement
Guest User

Habi-Jabi

a guest
Jul 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. class point
  5. {
  6.  
  7.     int x,y;
  8.  
  9. public:
  10.  
  11.     point()
  12.     {
  13.         x=y=0;
  14.     }
  15.  
  16.     point(int x, int y)
  17.     {
  18.         x=a;
  19.         y=b;
  20.     }
  21.  
  22.     void display()
  23.     {
  24.         cout<<"Point ("<<x<<" , "<<y<<");
  25.    }
  26.  
  27.  
  28. }:
  29.  
  30.  
  31. int main ()
  32. {
  33.    point p(3,9), q(2,7),r;
  34.    r= p + q;
  35.  
  36.  
  37.    r.display();
  38.  
  39.    if(p>q)
  40.    {
  41.        r=p-2;
  42.        r.display();
  43.    }
  44.    else
  45.    {
  46.        r=q-r;
  47.        r.display()
  48.    }
  49.  
  50.    p++;
  51.    p.display();
  52.  
  53.    ++p;
  54.    p.display();
  55.  
  56.    q=q*2;
  57.    q.display();
  58.  
  59.    return 0;
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement