Skip to content

Instantly share code, notes, and snippets.

@joaogui1
Created March 27, 2016 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaogui1/61fe421f5c508f5a652d to your computer and use it in GitHub Desktop.
Save joaogui1/61fe421f5c508f5a652d to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
struct ret {
double x1,y1,x2,y2;
};
ret vet[20];
char c;
int i,sz;
double x,y;
bool check;
int main(){
while(scanf(" %c", &c) and c != '*'){
scanf("%lf %lf %lf %lf", &vet[sz].x1, &vet[sz].y1, &vet[sz].x2, &vet[sz].y2);
sz++;
}
while(scanf("%lf %lf", &x, &y) and x != 9999.9 and y != 9999.9){
check = false;
i++;
for(int j = 0; j <= sz; j++){
if(x > vet[j].x1 and x < vet[j].x2 and y < vet[j].y1 and y > vet[j].y2){
check = true;
if(check)printf("Point %d is contained in figure %d\n",i,j+1);
}
}
if(!check)printf("Point %d is not contained in any figure\n",i);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment