Pages

Thursday, 20 January 2022

Chapter 23 // Exercise 1 - 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 1

Get the email file example to run; test it using a large file of your own creation. Be sure to include messages that are likely to trigger errors, such as messages with two address lines, several messages with the same address and/or same subject, and empty messages. Also test the program with something that simply isn't a message according to that program's specification, such as a large file contain no ---- lines.


I used the given website from the book to create a text file containing all the email examples:

I had to change the pointer to a reference in find_from_addr() to get the iterators to work with the for each loop but other than that, the code is exactly what's given in the book and it works.

I tested it with 2 files, the first contains lots of different emails from the website as well as messages that aren't emails (but still separated by ----) and it worked fine, finding all 7 emails sent from John Doe. 

The second text file has all the ---- lines removed and that found no emails from John Doe as it needs the ---- to tell it when to push back a message.

No comments:

Post a Comment