View Code of Problem 67

#include<stdio.h>
#include<math.h>

int main(){
	double k1,k2,b1,b2;
	double x[4]={0},y[4]={0};
	
	while(scanf("%lf%lf%lf%lf",&x[0],&y[0],&x[1],&y[1])!=EOF)
	{
		k1=k2=0;
		scanf("%lf%lf%lf%lf",&x[2],&y[2],&x[3],&y[3]);
		if(x[0]==x[1] && 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])||(x[0]!=x[1] && x[2]==x[3]))
				printf("Yes\n");
		else
		{		
		   k1=(y[0]-y[1])/(x[0]-x[1]);
		   k2=(y[2]-y[3])/(x[2]-x[3]);
		   b1=y[1]-k1*x[1];
		   b2=y[2]-k2*x[2];
		   if(k1==k2 && b1!=b2)
			  printf("No\n");
		   else 
			  printf("Yes\n");
		}
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 67