Wednesday 25 May 2022

Chapter 23 // Exercise 10 - Principles & Practice Using C++

In this exercise I am using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.

Chapter 23 // Exercise 10

Modify the table-checking program from section 23.9 to write a new table where the rows with the same initial digit (indication the year: first grades start with 1) are merged.


I honestly was really puzzled by this one. I guess he meant do exactly the same but while checking the lines create a new file where years are merged? So instead of seperate lines for 1A and 1B they get merged into 1? I hope that's what he meant because that's what I did.

I tried to keep things relatively simple. I originally thought of pushing back the table into a vector then erasing lines to create the table but then remembered this chapter was also about maps, not just regex. Maps can store a unique key which was perfect for checking to see if the current line had already been pushed back with the class sizes.

No comments:

Post a Comment