Advertisement
Adytzu04

POO L2P1

Oct 15th, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. //punct.h
  2. #ifndef L2P1_H
  3. #define L2P1_H
  4.  
  5. #include "l2p1.h"
  6. #include <iostream>
  7. #include <conio.h>
  8. using namespace std;
  9.  
  10. class Punct
  11. {
  12.     double x,y;
  13.  
  14. public:
  15.     void setX();
  16.     void setY();
  17.     double getX();
  18.     double getY();
  19.     void afis();
  20.  
  21. };
  22.  
  23. #endif;
  24.  
  25. //punct.cpp
  26.  
  27. #include "l2p1.h"
  28. #include "l2p1.h"
  29.  
  30.  
  31. void Punct::setX()
  32. {  
  33.     cout<<"x=";
  34.     cin>>x;
  35.     cout<<endl;
  36. }
  37.  
  38. void Punct::setY()
  39. {
  40.     cout<<"y=";
  41.     cin>>y;
  42.     cout<<endl;
  43. }
  44.  
  45. double Punct::getX()
  46. {
  47.     return x;
  48. }
  49.  
  50. double Punct::getY()
  51. {
  52.     return y;
  53. }
  54.  
  55. void Punct::afis()
  56. {
  57.     cout<<"x="<<x<<' '<<"y="<<y<<endl;
  58. }
  59.  
  60.  
  61.  
  62.  
  63. //main.cpp
  64.  
  65. #include "l2p1.h"
  66.  
  67.  
  68.  
  69. int main()
  70. {
  71.    
  72.     Punct a,b,c;
  73.    
  74.    
  75.     a.setX();
  76.     a.setY();
  77.     a.getX();
  78.     a.getY();
  79.     a.afis();
  80.    
  81.     b.setX();
  82.     b.setY();
  83.     b.getX();
  84.     b.getY();
  85.     b.afis();
  86.  
  87.     c.setX();
  88.     c.setY();
  89.     c.getX();
  90.     c.getY();
  91.     c.afis();
  92.  
  93.    
  94.  
  95.     _getch();
  96.     return 0;
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement