Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
53
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.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int xa, xb, ya, yb;         //położenie prostej
  8.     int x, y;                   //współżędne punktu który chcemy sprawdzić
  9.     cout << "Podaj wspolzedne prostej AB:" << endl;
  10.     cout<<"A:"<<endl;
  11.     cout<<"Xa: ";
  12.     cin>>xa;
  13.     cout<<"Ya: ";
  14.     cin>>ya;
  15.     cout<<"B:"<<endl;
  16.     cout<<"Xb: ";
  17.     cin>>xb;
  18.     cout<<"Yb: ";
  19.     cin>>yb;
  20.     cout<<"Podaj wspolzedne punktu C:"<<endl;
  21.     cout<<"X: ";
  22.     cin>>x;
  23.     cout<<"Y: ";
  24.     cin>>y;
  25.  
  26.     if(((y-ya)*(xb-xa))==((yb-ya)*(x-xa)))
  27.     {
  28.         cout<<"Punkt C lezy na prostej AB.";
  29.     }
  30.     else
  31.     {
  32.         cout<<"Punkt C nie lezy na prostej AB.";
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement