View Code of Problem 67

#include<stdio.h>
int main()
{
	double x[4],y[4];
	while(scanf("%lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1])!=EOF)
	{
		scanf("%lf %lf %lf %lf",&x[2],&y[2],&x[3],&y[3]);
		if(x[1]==x[0]&&x[2]==x[3])
		{
			if(x[0]==x[2])
			{
				printf("Yes\n"); 
			}
			else
			{
				printf("No\n");
			}
		}
		else if(x[0]!=x[1]&&x[2]!=x[3])
		{
			double a = (y[1]-y[0])/(x[1]-x[0]);
			double b = (y[3]-y[2])/(x[3]-x[2]);
			if(a!=b)
			printf("Yes\n") ;
			else if(y[0]-a*x[0]!=y[2]-b*x[2])
			printf("No\n");
			else
			printf("Yes\n"); 
		}
		else
		printf("Yes\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 67