Question: What am I missing in my code? Question: Functions can return a string, not just an int or a float. Write a function called evenOrOdd
What am I missing in my code?
Question:
Functions can return a string, not just an int or a float. Write a function called evenOrOdd which takes an integer parameter and returns either "Even" or "Odd" based on the value passed. In main, prompt the user for a number, called num, then pass num to evenOrOdd and display the returned value on the screen. Keep doing this until the user enters a zero. Use the given template to get started. Use the following run as an example:
Enter a number: 1 is Odd Enter a number: 2 is Even Enter a number: 3 is Odd Enter a number: 4 is Even Enter a number: 5 is Odd Enter a number: 0
Code:
#include
cout
Output:

1 Compare output 3 input Enter a number: 1 is Odo Enter a number: 2 is Even Enter a number: 3 is Odd Your output Enter a number: 4 is Even Enter a number: 5 is Odd Enter a number: 0 Enter a number: 1 is Odo Enter a number: 2 is Even Enter a number: 3 is Odd Expected output Enter a number: 4 is Even Enter a number: 5 is Odd Enter a number: 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
