Isspace

Hello!

I have this problam and can't seem to figure it out. The following:

The program I am trying to make is a quiz of some sort. It asks a question, then it compares the answer for the right answer and if the answer is white-space line it gives a next clue and if its wrong it gives the next question.

Anyways can't figure out how to make it figure the white-space line.

And if right answer is "correct" and you answer "c orre ct" it should still be fine. Any idea?

Thanks for the help!
Read the input into an std::string A, then create another string B. For every char of A, if it is not ' ', push it to B. Now if A was "a b ", B is "ab". If A was " ", B is "", so just compare B to "". If you consider no input different from entering a space, then skip this check if length of A is 0.
You can use remove_if: http://www.cplusplus.com/reference/algorithm/remove_if/
( You'll have to erase from the returned iterator to the end to remove duplicate characters )
Topic archived. No new replies allowed.