Input coordinate values (x, y) in the plane rectangular coordinate system that determines the point at which the quadrant or which of the coordinate axes.
Specific requirements:
Output Quadrant integer: 2, 3 or 4; lowercase letters output axes: x or Y; if the coordinates on the origin, the output number zero: 0;
Test Example:
Test Input: 1.3 -2.0
Expected Output: 4
test input: 0 -2.3
expected output: Y
test input: 00
expected output: 0
#include <iostream>
using namespace std;
int main()
{
float a,b=0; cin>>a>>b; if(a==0&&b==0) { cout<<0<<endl; } else if(a==0) { cout<<"y"<<endl; } else if(b==0) { cout<<"x"<<endl; } else if(a>0&&b>0) { cout<<1<<endl; } else if(a<0&&b>0) { cout<<2<<endl; } else if(a<0&&b<0) { cout<<3<<endl; } else if(a>0&&b<0) { cout<<4<<endl; }
}