### is it a true question?

Write a programe that inputs a series of integers and passes them ONE AT A TIME TO A FUNCTION 'EVEN' which uses the modulus operator to determine IF AN INTEGER IS EVEN THE FUNCTION SHOULD TAKE TWO INTEGER ARGUMENTS AND return true if the integer is even else return false.....
I can't understand this question...
I don't see why the function would take two integer arguments.
If you are required to test whether the number is odd or even, it needs just one argument, and a boolean return type.
It doesn't specify a whole lot, but you do need a function that will check if an integer is even:
 ``12345`` ``````bool is_even(int x) { if (x%2) return false; else return true; }``````

You also need to input a series of integers:
 ``123456789101112131415`` ``````int main() { int integers[10]; // input integers for (int i = 0; i < 10; ++i) cin >> integers[i]; // test each integer and do something for (int i = 0; i < 10; ++i) if ( is_even(integers[i]) ) cout << integers[i] << " is even\n"; return 0; }``````
I think the qusetion is not true....my teacher give me a assignment of 24 question and i was worry about this wrong question......once we pas an integer then the function again take two integers how its possible.....
Thanks for help...
But if you assume the function takes a single argument, then you can produce a solution, better than no answer at all.
You could use one of the arguments as an output instead of using a return type. The fact that it is an int instead of bool simply tells us that we are working in C instead of C++. It could be something like this I guess:
 ``12345`` ``````void is_even(int input, int* output) { if (input%2) *output = 0; else *output = 1; }``````
Last edited on
@ Stewbond Good point.