Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int xa, xb, ya, yb; //położenie prostej
- int x, y; //współżędne punktu który chcemy sprawdzić
- cout << "Podaj wspolzedne prostej AB:" << endl;
- cout<<"A:"<<endl;
- cout<<"Xa: ";
- cin>>xa;
- cout<<"Ya: ";
- cin>>ya;
- cout<<"B:"<<endl;
- cout<<"Xb: ";
- cin>>xb;
- cout<<"Yb: ";
- cin>>yb;
- cout<<"Podaj wspolzedne punktu C:"<<endl;
- cout<<"X: ";
- cin>>x;
- cout<<"Y: ";
- cin>>y;
- if(((y-ya)*(xb-xa))==((yb-ya)*(x-xa)))
- {
- cout<<"Punkt C lezy na prostej AB.";
- }
- else
- {
- cout<<"Punkt C nie lezy na prostej AB.";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement