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

What is the output of the following program? #include using namespace std; void

ID: 3697112 • Letter: W

Question

What is the output of the following program? #include using namespace std; void func1(); void func2(); int main() { int num; cout << "Enter 1 or 2: "; cin >> num; cout << endl; cout << "Take "; if (num == 1) func1(); else if (num == 2) func2(); else cout << "Invalid input. You must enter a 1 or 2" << endl; return 0; } void func1() { cout << "Programming I." <<endl ; } void func2 () { cout << "Programming II." << endl; } a. what is the out put if the in put is 1? b. What is the output if the imput is 2? c.   What is the output if the input is 3?    d.What is the output   if the input is -1?

Explanation / Answer

a) If the input is 1 the output is Take programming 1

b) If the input is 2 the output is Take programming 2

c) If the input is 3 the output is Take invalid input.You must enter a 1 or 2.

d) If the input is -1 the output is Take invalid input.You must enter a 1 or 2.