Advertisement
Spocoman

08. Point on Rectangle Border

Sep 6th, 2023
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     double x1, y1, x2, y2, x, y;
  7.     cin >> x1 >> y1 >> x2 >> y2 >> x >> y;
  8.  
  9.     bool firstCondition = (x == x1 || x == x2) && (y >= y1 && y <= y2);
  10.     bool secondCondition = (y == y1 || y == y2) && (x >= x1 && x <= x2);
  11.  
  12.     cout << (firstCondition || secondCondition ? "Border" : "Inside / Outside") << endl;
  13.    
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement