#include<iostream>
using namespace std;
#include<conio.h>
int main()
{
int x1,y1,x2,y2,x3,y3,slope1,slope2;
cout<<"Enter coordinates of 1st point (x1,y1) : ";
scanf("%d%d",&x1,&y1);
cout<<"Enter coordinates of 2nd point (x2,y2) : ";
cin>>x2>>y2;
cout<<"Enter coordinates of 3rd point (x3,y3) : ";
cin>>x3>>y3;
slope1=(y2-y1)/(x2-x1);
slope2=(y3-y2)/(x3-x2);
if(slope1==slope2)
{
cout<<"The given point fall on one straight line.";
}
else
{
cout<<"The given point does not fall on one straight line.";
}
getch();
return 0;
}
using namespace std;
#include<conio.h>
int main()
{
int x1,y1,x2,y2,x3,y3,slope1,slope2;
cout<<"Enter coordinates of 1st point (x1,y1) : ";
scanf("%d%d",&x1,&y1);
cout<<"Enter coordinates of 2nd point (x2,y2) : ";
cin>>x2>>y2;
cout<<"Enter coordinates of 3rd point (x3,y3) : ";
cin>>x3>>y3;
slope1=(y2-y1)/(x2-x1);
slope2=(y3-y2)/(x3-x2);
if(slope1==slope2)
{
cout<<"The given point fall on one straight line.";
}
else
{
cout<<"The given point does not fall on one straight line.";
}
getch();
return 0;
}
No comments:
Post a Comment