Advertisement
Spocoman

Point Of Segment(Ternary Operator)

Oct 1st, 2023
1,039
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int first, second, point;
  8.     cin >> first >> second >> point;
  9.  
  10.     cout << (point <= first && point >= second || point >= first && point <= second ? "in" : "out")
  11.         << endl << min(abs(first - point), abs(second - point)) << endl;
  12.  
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement