Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void prosta(int x1, int y1, int x2, int y2, int x3, int y3){
- int a, b;
- b = ((y1*x2)-(y2*x1)) / (x2-x1);
- a = (y2-y1)/(x2-x1);
- int logic = a*x3+b;
- if(logic == y3){
- cout<<"Lezy na prostej"<<endl;
- }
- else{
- cout<<" Nie lezy!";
- }
- }
- int main()
- {
- int a[3];
- int b[3];
- for (int i=0; i<3; i++){
- cout<<"Podaj [x"<<i+1<<",y"<<i+1<<"]"<<endl;
- cin>>a[i];
- cin>>b[i];
- }
- prosta(a[0],b[0],a[1],b[1],a[2],b[2]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement