Advertisement
andre_qramos

URI 1041 - Coordinates of a Point

Sep 3rd, 2020
2,386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include<iostream>
  2. #include <math.h>
  3. #include <iomanip>
  4. #include <cstdio>
  5. using namespace std;
  6.  
  7. int main() {
  8.     double x, y;
  9.     cin >> x >> y;
  10.     if(x == 0.0 && y == 0.0){
  11.         printf("Origem\n");
  12.         return 0;
  13.     }
  14.     if(x == 0.0){
  15.         printf("Eixo X\n");
  16.         return 0;
  17.     }
  18.     if(y == 0.0){
  19.         printf("Eixo Y\n");
  20.         return 0;
  21.     }
  22.     if(x < 0.0){
  23.         if(y < 0.0){
  24.             printf("Q3\n");
  25.             return 0;
  26.         }
  27.         if(y > 0.0){
  28.             printf("Q2\n");
  29.             return 0;
  30.         }
  31.     }
  32.     if(x > 0.0){
  33.         if(y < 0.0){
  34.             printf("Q4\n");
  35.             return 0;
  36.         }
  37.         if(y > 0.0){
  38.             printf("Q1\n");
  39.             return 0;
  40.         }
  41.     }
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement