Monday 5 October 2020

Chapter 17 // Exercise 11, 12 - Principles & Practice Using C++

In this exercise I am using Visual Studio 2017 and the std_lib_facilities header provided by Stroustrup.

Chapter 17 // Exercise 11, 12

11. Complete the "list of gods" example from section 17.10.1 and run it.
12. Why did we define two versions of find().

Github: https://github.com/l-paz91/principles-practice/tree/master/Chapter%2017/Exercise%2011

Wow, linked lists are confusing. I never want to read prev->succ = prev if !prev then succ = prev->succ etc....

For exercise 12 I had to go read the small section in Chapter 18. Basically, it's to stop someone from change what Link* is pointing at. In the functions I try to always assign the pointer to a new temp pointer to avoid messing with the original. I feel like this is the same case here.

No comments:

Post a Comment