Pages

Monday, 2 March 2020

Chapter 11 // Exercise 8 - Principles & Practice Using C++

In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:

http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Chapter 11 // Exercise 8

         Use the program from the previous exercise to make a dictionary (as an alternative to the approach in section 11.7). Run the result on a multi-page text file, look at the result, and see if you can improve the program to make a better dictionary.
Make a dictionary? Is this guy having a giraffe? Also what is a multi-page text file? A txt document doesn't have pages. Also, having read over section 17 again I think he just wants us to run the previous program on a text file and remove all punctuation and contractions, whilst displaying each word on a new line. I can do that easy however that's not a dictionary. A dictionary has definitions of what each word means.

Also, most dictionaries allow some forms of contractions; but they do tend to differ on what is allowed depending on the country. The same applies to hyphenated words as some are common enough to be included in dictionaries. So I decided to allow contractions, hyphens and remove any other form of punctuation and numbers and then output each word on a separate line after being sorted. I started getting a bit pedantic about things as well like removing duplicated words.

No comments:

Post a Comment