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
http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h
Chapter 11 // Exercise 3
Write a program that removes all vowels from a file ("disemvowels"). For example, Once upon a time! becomes nc pn tm!. Surprisingly often, the result is still readable; try it on your friends.
Once again the find functions on a string come to the rescue. I think I'm becoming a bit addicted to using find_first_not_of and find_first_of; they're just so god damn handy. I know these functions haven't been introduced in the book yet but this isn't prior knowledge I already had. I only learnt about them when googling how to solve problems like "find a character in a string" so I don't think it's cheating. Also rdbuf() and stringstreams are definitely ones I'll have to remember.
No comments:
Post a Comment