Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ language What is the output of the following code fragment? You may assume it is part of a complete, correct C++ program. Please use
C++ language
What is the output of the following code fragment? You may assume it is part of a complete, correct C++ program. Please use pencil and erase mistakes. You may not type. Assume the output starts at the left end of the top line below. Show your work (variable boxes, etc.). You will not get any points if you do not show your work for this. Do not use the output lines for your scratch work, they are for the output only.
int mystery( int &a, int b )
{ int c = a + b;
a = c + a / b;
b = a + c; cout << a << ' ' << b << ' ' << c << endl; return a + b + c;
}
int main( void )
{ int a = 3, b = 4; int c = mystery( b, a ); cout << a << ' ' << b << ' ' << c << endl; a = mystery( b, c ); cout << a << ' ' << b << ' ' << c << endl; return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started