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

Complete the system stack diagram for Code Listing 2.2 showing the state of the

ID: 3653657 • Letter: C

Question

Complete the system stack diagram for Code Listing 2.2 showing the state of the system stack at various points during the execution of the program if the user enters 1 and 2 at the input prompt. Also, give the output of the program. Code Listing 2.2 1. #include 2. 3. using namespace std; 4. 5. void funct1(int& a, int& b) 6. { 7. cout<<"Enter two numbers: "; 8. cin>>b>>a; 9. /* Point 2 */ 10. } 11. 12. void func2(int& a, int& b, int& c) 13. { 14. int z = c + 1; 15. b++; 16. c = 2 * z; 17. a = b + c; 18. /* Point 4 */ 19. } 20. 21. void func3(int a, int b, int c) 22. { 23. b = a*(b - c); 24. } 25. 26. int main( ) 27. { 28. int a = 0, b = 0, c = 0; 29. /* Point 1 */ 30. cout <<a<<" "<<b<<" "<<c<<endl; 31. func1(b,a); 32. /* Point 3 */ 33. cout <<a<<" "<<b<<" "<<c<<endl; 34. func2(c,a,b); 35. /* Point 5 */ 36. cout <<a<<" "<<b<<" "<<c<<endl; 37. func3(b,c,a); 38. /* Point 6 */ 39. cout <<a<<" "<<b<<" "<<c<<endl; 40. return 0; 41. } Output:

Explanation / Answer

/point 1/ 0 0 0 /point 2/ 2 1 0 /point 3/ 4 2 2 /point 4/ 2 4 4

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