Hi. I need to write a function that tests whether an integer is even or not. This is how far I've got. I wasn't sure if its best to use an 'if' statement in the function.
cheers.Code:/* a function that tests whether an integer is even, returning a true or false
answer */
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cout << "Enter a number: ";
cin >> n;
cout << test(n) << endl;
return 0;
}
int test(int n)
{
if (n