Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5.  
  6. class Punkt {
  7. private:
  8. int x;
  9. int y;
  10. public:
  11. static Punkt punktOdniesienia;
  12. Punkt(int x, int y) {
  13. this->x=x;
  14. this->y=y;
  15. }
  16. int getx() {
  17. return x;
  18. }
  19. int gety() {
  20. return y;
  21. }
  22. static void setPunktOdniesienia(int x, int y){
  23.  
  24. }
  25. int odlOdPunktuOdniesienia(Punkt&p) {
  26. return sqrt((p.x - punktOdniesienia.x)^2 + (p.y - punktOdniesienia.y)^2);
  27. }
  28. static void wyswietlpod(){
  29. cout << "Punkt odniesienia: (" <<punktOdniesienia.x << "," <<punktOdniesienia.y << ")" <<endl;
  30. }
  31. };
  32.  
  33. Punkt Punkt::punktOdniesienia(0,0);
  34.  
  35. int main(){
  36.  
  37. Punkt p1(2,3);
  38. cout << "Punkt P (" << p1.getx() << "," << p1.gety() << ")" <<endl;
  39. Punkt::wyswietlpod();
  40. cout << "Odleglosc od punktu odniesienia"
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement