Manipulating variables of type 'string'

I have to write a program for school that prompts the user for a text made up of 5 words each ending with a '/', then extracts and prints each word without the '/'. At each step I have to print the extracted word, the remaining string, and the length of the remaining string... No loops allowed.
I've been working on it all day and all I know how to do is getline(cin, string)! I know I have to use substrings and string length, but I keep getting error messages.
I'd really appreciate any hints on how to extract/store the different words.

Thanks
You need to do http://cplusplus.com/reference/string/string/find/ ,then use http://cplusplus.com/reference/string/string/substr/ to get both sides of '/'. Print the first and repeat the procedure with the second.
What errors were you getting? (post code)
Hallelujah!! Thanks a lot hamsterman! If you were next to me I would kiss you! I didn't think it was that easy.
Last edited on
Topic archived. No new replies allowed.