Skip to content

Commit 055d5fc

Browse files
committed
added comments
1 parent 0efd1e2 commit 055d5fc

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

C++/17_Coordinates_of_a_Point.cpp

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
#include <iostream>
22
using namespace std;
3-
3+
44
int main()
55
{
6+
// Delcare float variable for x and y co-ordinates and input it
67
float x, y;
78
cin >> x >> y;
8-
9+
10+
// If both x and y coordinates are zero then point at on origin
911
if (x == 0 && y == 0)
1012
cout << "Origem";
11-
13+
14+
// If both x and y coordinates are greater than zero then the point lies in first quadrant
1215
else if (x > 0 && y > 0)
1316
cout << "Q1";
14-
17+
18+
// If the x coordinate is greater than zero and y is less then point lies in fourth quadrant
1519
else if (x > 0 && y < 0)
1620
cout << "Q4";
17-
21+
22+
// If x is coordinate is less than zero and y is greater then point lies in second quadrant
1823
else if (x < 0 && y > 0)
1924
cout << "Q2";
20-
25+
26+
// If both x and y coordinates are less than zero then point lies in third quadrant
2127
else if (x < 0 && y < 0)
2228
cout << "Q3";
23-
29+
30+
// If x coordinate is zero then the point lies on y axis
2431
else if (x == 0 && y != 0)
2532
cout << "Eixo Y";
26-
33+
34+
// If x coordinate is zero then the point lies on y axis
2735
else if (y == 0 && x != 0)
2836
cout << "Eixo X";
29-
37+
3038
return 0;
3139
}

0 commit comments

Comments
 (0)