In this exercise I am using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.
Chapter 23 // Exercise 9
Using eof(), it is possible to determine which line of a table is the last. Use that to (try to) simplify the table-checking program from section 23.9. Be sure to test your program with files that end with empty lines after the table and with files that don't end with a newline at all.
from_string() also has to be created for the code to work. This is found on page 853 but I added it to my running version of std_lib_facilities.
This was an annoying one to read as it's hard to determine how many tab/spaces there are in the printed book. I also had to type up the table as he doesn't provide it and made sure it matched the patterns he gave.
I also misunderstood the question and thought that he was suggesting that you could use eof() to determine newlines?? My brain goes to strange places. Anyway, I added a simple check that looks for new lines anywhere to skip them.
No comments:
Post a Comment