Value Parameter Exercise: isEven
Create ex1_is_even.cpp
with the following code in the Visual Studio project or copy the following code into your IDE:
The purpose of this program is to learn the parts of and practice using a user defined function.
Complete the Program
- Read the program and add code to complete it.
- Compile and run this C++ program.
- Test whether your program correctly reports even and odd for both negative and positive numbers.
- The program output should look like the following:
Enter an integer: 12 Is 12 even? yes Enter an integer: 23 Is 23 even? no Enter an integer: -17 Is -17 even? no Enter an integer: -466 Is 466 even? yes
When you are done:
- Take a screenshot of your IDE and console window after compiling and then running the program four times. Use the following inputs:
- an even positive number
- an odd positive number
- an even negative number
- an odd negative number
- For this exercise, you will have:
ex1_is_even.cpp
. - Complete all the exercises in this lab and upload the .cpp files and screenshots for the output.