forked from Shubhamlmp/Programming-Practice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path17_Coordinates_of_a_Point.cpp
39 lines (30 loc) · 1.09 KB
/
17_Coordinates_of_a_Point.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
using namespace std;
int main()
{
// Delcare float variable for x and y co-ordinates and input it
float x, y;
cin >> x >> y;
// If both x and y coordinates are zero then point at on origin
if (x == 0 && y == 0)
cout << "Origem";
// If both x and y coordinates are greater than zero then the point lies in first quadrant
else if (x > 0 && y > 0)
cout << "Q1";
// If the x coordinate is greater than zero and y is less then point lies in fourth quadrant
else if (x > 0 && y < 0)
cout << "Q4";
// If x is coordinate is less than zero and y is greater then point lies in second quadrant
else if (x < 0 && y > 0)
cout << "Q2";
// If both x and y coordinates are less than zero then point lies in third quadrant
else if (x < 0 && y < 0)
cout << "Q3";
// If x coordinate is zero then the point lies on y axis
else if (x == 0 && y != 0)
cout << "Eixo Y";
// If x coordinate is zero then the point lies on y axis
else if (y == 0 && x != 0)
cout << "Eixo X";
return 0;
}