We are supposed to debug this program: http://pastebin.com/kqziUa5V so that when
ID: 3658790 • Letter: W
Question
We are supposed to debug this program: http://pastebin.com/kqziUa5V so that when given this input: http://pastebin.com/pSBswK3z the output would be: The tour 1 9 10 5 6 7 3 2 4 8 1 costs 2000 The purpose of this assignment was to show our skills using GDB debugger to find and correct the problem. I've realized that the best_cost value does not get passed into the permute_list call on line 49, so that the comparison on line 68 never works because best_cost is always 0 when that if statement is called. I haven't been able to come up with a solution that works.Explanation / Answer
The first error is that the best_cost is redefined under main, so in the function it uses the global value, inside main the local value. So remove the best_cost decl in main. Thats not the only issue. Repost the problem I will get back to you.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.