Removing multiple spaces

Hello! I'm new to C++ and I am having some trouble programming a function that reads a sentence from a file such as:
"Hello World! Today is Awesome!"
(note the multiple spaces between words). I need to change it so there is only ONE space between each word. Right now I am using:

if ((isspace(myCh)) && (streamOne.peek() == ' '))

I don't want to use peek(). I also want to avoid arrays. Is there a way to do this using get() and putback()?

Thanks :
Last edited on
Topic archived. No new replies allowed.