Advertisement
STANAANDREY

geo

May 6th, 2019
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <windows.h>
  4. using namespace std;
  5.  
  6.  struct point
  7. {
  8.   int x,y;
  9. };
  10.  struct line
  11. {
  12.  point A,B;
  13. };
  14. line AB;
  15. point C;
  16. bool ver();
  17.  
  18. int main()
  19. {
  20.     system("title GEO");
  21.     float d;
  22.  
  23. cout<<"vector AB-coord pct A \n x=";
  24. cin>>AB.A.x;
  25. cout<<" y=";
  26. cin>>AB.A.y;
  27. cout<<"vector AB-coord pct B \n x=";
  28. cin>>AB.B.x;
  29. cout<<" y=";
  30. cin>>AB.B.y;
  31. d=sqrt(pow((AB.B.x-AB.A.x),2)+pow((AB.B.y-AB.A.y),2));
  32. cout<<"|AB|="<<d<<endl;
  33. cout<<"pct C \n x=";
  34. cin>>C.x;
  35. cout<<" y=";
  36. cin>>C.y;
  37. if (ver())
  38.     cout<<"A,B,C-coliniare";
  39. else
  40.     cout<<"A,B,C-nu sunt coliniare";
  41.     return 0;
  42. }
  43. bool ver()
  44. { return static_cast<bool>((C.y-AB.A.y)*(AB.B.x-AB.A.x)-(C.x-AB.B.y-AB.A.y)); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement