Write a program that prompts the user to input the x-y coordinate of a point in a Cartesian plane.
The program should then output a message indicating whether the point is the origin, is located
on the x-axis or y-axis, or appears in particular quadrant (1st quadrant, 2nd quadrant, 3rd quadrant
or 4th quadrant).
#include<iostream>
using namespace std;
int main(){
int x,y;
cout<<"Enter x and y co ordinates respectly"<<endl;
cin>>x>>y;
if((x>0) && (y>0)){cout<<"first quadrant"<<endl;}
if((x<0) && (y>0)){cout<<"second quadrant"<<endl;}
if((x<0) && (y<0)){cout<<"second third"<<endl;}
if((x>0) && (y<0)){cout<<"second fourth"<<endl;}
if((x==0) && (y==0)){cout<<" origin"<<endl;}
return 0;}
Comments
Leave a comment