//Program to check whether the poin lies on x axis, y axis or origin
#include<iostream>
using namespace std;
class point
{
int x,y;
public:
void in()
{
cout<<"Enter the point: \n";
cout<<"x co-ordinate: ";
cin>>x;
cout<<"y co-ordinate: ";
cin>>y;
}
void check()
{
if((x==0) && (y==0))
{
cout<<"Point lies on origin";
}
else if(x==0)
{
cout<<"Point lies on y-axis";
}
else if(y==0)
{
cout<<"Point lies on x-axis";
}
else
{
cout<<"Point lies somewhere between x-axis and y-axis";
}
}
};
int main(void)
{
point p;
p.in();
p.check();
}
No comments:
Post a Comment
Comments please: