Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. using namespace std;
  4.  
  5. class point {
  6.     int x,y;
  7.    
  8. public: point(){
  9.         x=0;
  10.         y=0;
  11. }
  12. ///////////////
  13. int getx()
  14.     {
  15.     return x;
  16.     }
  17.     //////////////////
  18. int gety()
  19.     {
  20. return y;
  21.     }
  22. ////////////////////////
  23.     void setx(int s)
  24.     {
  25.         x=s;
  26.     }
  27. //////////////////
  28.     void sety(int s)
  29.     {
  30.         y=s;
  31.     }
  32. ////////////////////
  33. void deplacer(int a,int b)
  34. {
  35.     x=x+a;
  36.     y=y+b;
  37. }
  38. ////////////////////
  39. void afficher()
  40. {printf("les coord du pt est :%d,%d",x,y);
  41. }
  42.  
  43. /////////////
  44. };
  45.  
  46.  
  47. main()
  48. {point z;
  49. z.setx(2);
  50. z.sety(3);
  51. z.afficher();
  52.    
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement