Advertisement
kolioi

43. Find POINT if inside or outside C++

Dec 20th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main()
  5. {
  6.     using namespace std;
  7.  
  8.     vector<pair<int, int>> rect;
  9.     int x, y;
  10.     for (int i = 0; i < 2; i++)
  11.     {
  12.         cin >> x >> y;
  13.         rect.push_back(make_pair(x, y));
  14.     }
  15.  
  16.     cin >> x >> y;
  17.     if (rect[0].first <= x && x <= rect[1].first &&
  18.         rect[0].second <= y && y <= rect[1].second)
  19.         cout << "Check point is inside\n";
  20.     else
  21.         cout << "Check point is outside\n";
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement