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 6
Write a program that replaces punctuation with whitespace. Consider .(dot),
; (semicolon), ,(comma), ? (question mark), - (dash), ' (single quote)
punctuation characters. Don't modify characters within a pair of double
quotes ("). For example "-don't use the as-if rule." becomes " don t use the
as if rule ".
; (semicolon), ,(comma), ? (question mark), - (dash), ' (single quote)
punctuation characters. Don't modify characters within a pair of double
quotes ("). For example "-don't use the as-if rule." becomes " don t use the
as if rule ".
I'm sure there's a more elegant way to do this than if's and counting quotes but it isn't too ugly to I'll allow it.
No comments:
Post a Comment