Advertisement
JOHNYTHEWINNER

x,y in/outsquare

Jan 26th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6.  
  7.  
  8.  
  9. int main()
  10. {
  11.     double x1, y1, x2, y2, x, y;
  12.     cin >> x1;
  13.     cin >> y1;
  14.     cin >> x2;
  15.     cin >> y2;
  16.     cin >> x;
  17.     cin >> y;
  18.     bool vertical = (x == x1 || x == x2) && (y >= y1 && y <= y2);
  19.     bool horizontal = (x >= x1 && x <= x2) && (y == y1 || y == y2);
  20.     if (horizontal == 1 || vertical == 1)
  21.     {
  22.         cout << "Border" << endl;
  23.     }
  24.     else
  25.     {
  26.         cout << "Inside / Outside" << endl;
  27.     }
  28.  
  29.  
  30.  
  31.    
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement