I'm working on my program right now with strings. I tried to play with this command a little bit, but it might at least help you.
If you read in each like as a string, you can use the "find()" function. It goes something like this:
Code:
ifstream in ("filename");
string blah;
while (!in.eof())
{
in >>blah;
cout <<blah.find("d") <<endl;
}
I have to work on my own program, but that might be something to think about... instead of trying to populate an array with an entire paragraph or something. You can just search one word at a time. I'll leave it up to you to think of some creative way to get it to tell you what row its in. This function will only return the array position "d" is in each word. One drawback, if the letter "d" is not in the word, it returned a very large number. Oh yes, in order to use the variable type "string" and the "find()" function, you will have to include the string library which could be:
Code:
#include <cstring>
#include <string>
#include <string.h>
I have to use "#include <string>"