I know how to right c++ code to determine in an (int) is odd or even. How would I add a boolean function to do the same thing. I have to input an number then determine if it's odd or even.

I have to add 3 numbers one at a time then determine if each is either odd or even.

Recommended Answers

All 3 Replies

The function should be declared to return bool. If the value is even then return true otherwise return false.

would I do this for every number?

yes. Pass the number you want evaluated as a parameter to the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.