nyist_68_三点顺序

 1 #include <cstdio>

 2 #include <iostream>

 3 

 4 using namespace std;

 5 

 6 struct point {

 7     int x, y;

 8 }A, B, C;

 9 

10 int crossProd(point A, point B, point C) {//叉乘 

11     return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);

12 }

13 

14 int main() {

15     while (1) {

16         scanf ("%d%d%d%d%d%d", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y);

17         if (A.x + A.y + B.x + B.y + C.x + C.y == 0) break;

18         if (crossProd(A, B, C) > 0) printf ("0\n");//点顺时针给出 

19         else printf ("1\n");//点逆时针给出 

20     }

21     return 0;

22 }

 

你可能感兴趣的:(顺序)