Hi, let`s say I input a series of strings separated by 4 spaces like:
string x="Hi my name is bob";
i know if i do this: x.find(" "); it will give me the numerical value where the first space char is located, but how about the other ones?
how would I find the value of where the space after "my" is?
My teacher said something about find next function. So how do i use that or is there anything else!?
You can use this: x.find(substring, pos); where pos is the position to start searching.
so if you want to find the value after "my" you use: x.find(" ", 3);
remember find function return the index of the first occurrene of the substring, or string::npos value if no substring was found