/* Program for displaying the position of point (x,y) in 2D Coordinate System. The program will ask the user for the integer value of x & y and then display the results */ #include <iostream> using namespace std; int main() { int x, y; cout << "Enter x and y?\n"; cin >> x >> y; if (x>0) { if (y>0) cout << "First Quadrent \n"; else if (y<0) cout << " Fourth Quadrent \n"; else if (y == 0) cout << " x-axis \n"; } else if (x < 0) { if (y > 0) cout << " Second Quadrent \n"; else if (y < 0) cout << " Third Quadrent \n"; else if (y == 0) cout << " x-axis\n"; } else if (x == 0) { if (y == 0) cout << " Origin\n"; else if (y != 0) cout << " y-axis\n"; } return 0; }
This blog is about coding in some commonly used "High Level Languages" like C, C++, Java etc. At first, I will post here basic programs written in C++ language only.
Wednesday, November 19, 2014
C++ Program to find the Quadrent in 2D Coordinate System (x,y)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment