triangle.c |
| /************************************** James little Programming Competition Practice. Problem D Lines and Points and Trianlges. ***************************************/ #include <stdio.h> #include <stdlib.h> main(){ int x,y,x1,y1,x2,y2; int cross_product = -1; while(1){ scanf("%d %d %d %d %d %d", &x, &y, &x1, &y1, &x2, &y2); if(x == 0 && y == 0 && x1 == 0 && y1 == 0 && x2 == 0 && y2 == 0) break; cross_product = ((y1-y)*(x2-x1)-(x1-x)*(y2-y1)); if(x == x1 && x1 == x2 && y == y1 && y1 == y2) printf("Point\n"); else if(cross_product) printf("Triangle\n"); else printf("Line\n"); } return EXIT_SUCCESS; } |
James Little |