In my program, I have to input a word and then a character. The program will tell me how many times does the character appear in the word...my problem is that I have to find this character with the find(str,ind)...I know the ind is the index and can be manipulated with a loop...but what about the "str" part of it? I know that's where the character should be, so can I put the name of the variable in which the char is stored?

Don't you mean you need to use std::string's find() method? e.g.

std::string word = "Hello";
size_t pos = word.find('.', 0);

In the above, just put it in a loop and replace the second parameter to find() with the variable pos that was returned by the previous find. Keep doing that until find returns string::npos.

Ok, that helped a lot...thanks AD..and thanks for the reference jonsca.

This question has already been answered. Start a new discussion instead.