No troll. You asked about assigning characters that include spaces to a string, and I posted a way to do it. If you'd actually asked about what you really want to know - about reading text from a file - then you would have gotten the answer you were looking for.
We can't read your mind to know what you really meant. All we have is the words you actually chose to type.
Instead, you should read in the input and count your own "non-space" characters.
Not an option, it should work with any data. We have 26 chars of random text and some variables on each line. Maybe somehow tell it to read into a string until it sees variables (unlike in mine given example earlier, text does not contain numbers)?
Well, to recognise an integer, one way would be to read character-by-character and test each one to see whether it was a digit (or possibly a + or - sign which could be the first character of an integer). Though I'm sure that's not the only way.
Managed to fix this by ending line before reading chars with in.ignore(90, '\n');, but can anyone explain please what this 90 actually means?
with no number it screws up, but seems that practically any number will do just as good as 90 :D