Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. class Punto
  5. {
  6. double x, y;
  7. public:
  8. Punto (double, double);
  9. ~Punto();
  10. Punto (const Punto &);
  11. double getX();
  12. double getY();
  13. double norma ();
  14.  
  15. };
  16. Punto :: Punto(double xx, double yy) //costruttore
  17. {
  18. x= xx;
  19. y=yy;
  20. }
  21. Punto :: ~ Punto() //distruttore
  22. {
  23. cout <<"Chiamata al distruttore.\n"<< endl;
  24. }
  25. Punto:: Punto (const Punto &Punto) //costruttore di copia
  26. {
  27. y = Punto.y;
  28. x= Punto. x;
  29. }
  30. double Punto::getX() {
  31. return x;
  32. }
  33.  
  34. double Punto::getY() {
  35. return y;
  36. }
  37. double Punto:: norma( double x, double y) {
  38.  
  39. norma= (sqrt( x^2 + y^2));
  40. return norma;
  41.  
  42. }
  43.  
  44. int main()
  45. {
  46. cout << "Hello world!" << endl;
  47. Punto P(2, 5);
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement