fork download
  1. #include<iostream>
  2. #include<cmath>
  3. #include "point.h"
  4. using namespace std;
  5.  
  6. Point::Point()
  7. {
  8. x = 0.0;
  9. y = 0.0;
  10. }
  11.  
  12. Point::Point(double xvalue, double yvalue)
  13. {
  14. SetAll(xvalue, yvalue);
  15. }
  16.  
  17. void Point::SetAll(double xvalue, double yvalue)
  18. {
  19. x = xvalue;
  20. y = yvalue;
  21. return;
  22. }
  23.  
  24. double Point::GetX(void) const
  25. {
  26. return x;
  27. }
  28.  
  29. double Point::GetY(void) const
  30. {
  31. return y;
  32. }
  33.  
  34. double Point::Distance(Point p)
  35. {
  36. return sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
  37. }
  38.  
  39. double Point::Slope(Point p)
  40. {
  41. double slope = 0;
  42. double xdelta = x - p.x;
  43. double ydelta = y - p.y;
  44.  
  45. if(xdelta != 0)
  46. {
  47. slope = ydelta/xdelta;
  48. }
  49. else
  50. {
  51. return UNDEFINED;
  52. }
  53.  
  54. return slope;
  55. }
  56.  
  57.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:19: fatal error: point.h: No such file or directory
 #include "point.h"
                   ^
compilation terminated.
stdout
Standard output is empty