Sunday, July 17, 2016

UVA 476 Solution

Unknown
#include<cstdio>
using namespace std;

int main()
{
    double x1[10],y1[10],x2[10],y2[10],x,y;
    char ch;
    int k=0;
    while (scanf("%c",&ch))
    {
        if (ch=='*') break;
        scanf("%lf%lf%lf%lf",&x1[k],&y1[k],&x2[k],&y2[k]);
        k++;
        getchar();
    }
    int l=0;
    while (scanf("%lf%lf",&x,&y)==2)
    {
        if (x==9999.9 && y==9999.9) break;
        l++;
        int flag=1;
        for (int i=0;i<k;i++)
        {
            if (x>x1[i] && y<y1[i] && x<x2[i] && y>y2[i])
            {
                printf("Point %d is contained in figure %d\n",l,i+1);
                flag=0;
            }
        }
        if (flag) printf("Point %d is not contained in any figure\n",l);
    }
   
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,