Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Get a copy of the is_even.cpp file by: --------------------------- -------------

ID: 3844852 • Letter: G

Question

Get a copy of the is_even.cpp file by:

---------------------------

----------------------------

Entering the cp command: cp /net/data/ftp/pub/class/110/ftp/cpp/is_even.cpp is_even.cpp

or, using your mouse to copy and paste the program into Pico, or

using the Hercules command-line ftp program to copy this file from the CS Department's anonymous ftp site.

The purpose of this program is to practice using user defined functions.

Add code to the program to complete it.

Compile and run this C++ program.

The program output should look like the following:

Explanation / Answer

I have completed that function is_even

#include <iostream>

using namespace std;

void is_even(int); // Function Prototype

int main( )

{

int num;

cout << "Enter an integer: ";

cin >> num;

cout << "Is " << num << " even? ";

is_even(num);

cout << endl;

return 0;

}

// "is_even" function.

// Prints "yes" if a is even, "no" otherwise.

void is_even(int a)

{

if(a%2 ==0)

{

cout<<"yes";

}

else{

cout<<"no";

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote