#include <iostream>
using namespace std;
class test
{
public:
int a;
void getdata();
void checkdata();
};
void test::getdata()
{
cout<<"\nEnter the number :";
cin>>a;
cout<<a;
}
void test::checkdata()
{
if(a==0)
{
cout<<"\nZero";
}
else if(a>0)
{
cout<<"\nThe given number is positive";
}
else
{
cout<<"\nThe given number"<<a<< " is negative";
}
}
int main() {
test x;
cout <<"Positive or not using class"<<endl;
x.getdata();
x.checkdata();
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: