i have written this program.
it excecutes without any errors and even gives me the correct answer.
the program is to tell whether the integer is odd or even.
the problem is that i want a series of integers and passes them one at a time to function even.
Sample Screen display
Enter an integer: 8
8 is an even integer
Enter an integer: 3
3 is an odd integer
Enter an integer: 99
99 is an odd integer
This is the programme i have written so far, i just want to know what im doing wrong and how to correct it.
include <iostream>
bool even(int x);
using namespace std;
void main()
{
int x;
std::cout << "Enter an integer: ";
std::cin >> x;
if(even(x))
std::cout << x << " is an even number." << endl;
else
std::cout << x << " is an odd number." << endl;
}
bool even(int x1)
{
return (x1%2 == 0);
}