Now to rid the extra white spaces, I was told to use a loop and not isspace etc. Just a simple if statement, if (symbol == ' ') then delete the whitespace. But my problem is, if I do this:
if (symbol == ' ')
cout << '\b';
that will delete all white spaces and scrunch all the text together. What can I add in the do/while loop above that will only delete the "extra" white space, but leave a space between each word?
Some of you attempted to answer my question, but I still can't seem to make this work.
Since it is a loop, you can make an iteration modify the behaviour of the next one.
You can set a bool to true when you printed a whitespace, unset it when you don't have a whitespace and print the current character only when that bool is false.
Or
Declare a char and set it to the current character only after having checked it against the current character - so it will hold the old value -