1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#define N 10 struct { double x1, y1, x2, y2; }rec[11]; int main() { int count = 1; while (getchar()=='r') { scanf("%lf%lf%lf%lf", &rec[count].x1, &rec[count].y1, &rec[count].x2, &rec[count].y2); count++; getchar(); }
bool in; int i = 0; double x, y; while (scanf("%lf%lf", &x, &y) && x != 9999.9&&y != 9999.9) { in = false; i++; for (int j = 1; j<count; j++) if (x > rec[j].x1&&x < rec[j].x2&&y<rec[j].y1&&y > rec[j].y2) { printf("Point %d is contained in figure %dn", i, j); in = true; }
if (!in) printf("Point %d is not contained in any figuren", i); } return 0; }
|
近期评论