Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <windows.h>
- using namespace std;
- struct point
- {
- int x,y;
- };
- struct line
- {
- point A,B;
- };
- line AB;
- point C;
- bool ver();
- int main()
- {
- system("title GEO");
- float d;
- cout<<"vector AB-coord pct A \n x=";
- cin>>AB.A.x;
- cout<<" y=";
- cin>>AB.A.y;
- cout<<"vector AB-coord pct B \n x=";
- cin>>AB.B.x;
- cout<<" y=";
- cin>>AB.B.y;
- d=sqrt(pow((AB.B.x-AB.A.x),2)+pow((AB.B.y-AB.A.y),2));
- cout<<"|AB|="<<d<<endl;
- cout<<"pct C \n x=";
- cin>>C.x;
- cout<<" y=";
- cin>>C.y;
- if (ver())
- cout<<"A,B,C-coliniare";
- else
- cout<<"A,B,C-nu sunt coliniare";
- return 0;
- }
- bool ver()
- { 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