How do I extract first letter of the second word in a string?

I'm trying to extract the first letter of the second word.
Say the string is:

string UserInput = a b;

I get a from UserInput[0], but not b from UserInput[1] or [2].
So I figured I have to do something different to get into the second word?
If UserInput[2] is not "b", then UserInput is not "a b".

To extract the first letter of the second word of a string you have to find the second word in the string.:)
There are several methods to do the task. For example you can use member functions of the class string such as find() to find the second word. Or you can use istringstream to do the same.
Topic archived. No new replies allowed.