A simple program to check if the given number is an odd or even number using structure in C++.
My mobile number here in the Philippines is 09173084360.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
#include <iostream>
#include <iomanip>
using namespace std;
struct odd {
int n;
int odd_even() {
if (n % 2 == 0)
{
cout << n <<" Number is even!\n";
}
else
{
cout << n << " Number is odd!\n";
}
return(n);
}
};
main() {
odd value;
cout << "\t\t ODD and Even Number Determiner";
cout << "\n\n";
cout << "Enter a Number :";
cin >> value.n;
cout << "\n\n";
cout << value.odd_even();
cout << "\n\n";
system("pause");
}