#include <iostream>
using namespace std; 
class oddeven
{
    public :
    int n; 
    void getdata();
    void find();
};
void oddeven::getdata()
{
    cout <<"\n Enter the number : "; 
    cin>>n; 
    cout <<n<<endl; 
}
void oddeven ::find ()
{
    if (n%2==0)
    cout <<"\n The given number is even";
    else 
    cout <<"\n The given number is odd ";
}

int main() {
    oddeven s; 
    cout <<"\n Odd or even using class";
    s. getdata ();
    s. find ();
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: