There are many ways to do function-call tracing in C++, where the simplest method is to just print “Entering function X” when entering the function, and right before returning print “Leaving function X”. It’s a lot of work though, especially if the function have multiple return statements. One solution to the problem above is to …