View Code of Problem 67

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int x1,x2,y1,y2;
	while(cin>>x1>>y1>>x2>>y2)
	{
		int xx1,xx2,yy1,yy2;
		cin>>xx1>>yy1>>xx2>>yy2;
		if(x1==x2)
		{
			if(xx2==xx1)
			cout<<"No"<<endl;
			else
			cout<<"Yes"<<endl;
		}
		else if(y1==y2)
		{
			if(yy2==yy1)
			cout<<"No"<<endl;
			else
			cout<<"Yes"<<endl;
		}
		else 
		{
			double k1=(y1-y2)/(x1-x2);
			if(yy1==yy2||xx1==xx2)
			cout<<"Yes"<<endl;
			else
			{
			double k2=(yy1-yy2)/(xx1-xx2);
			if(k1==k2)
			cout<<"No"<<endl;
			else
			cout<<"Yes"<<endl;
			}
			
		}
	}
	return 0;
 } 

Double click to view unformatted code.


Back to problem 67