Hi,
So an exercise I have is to read each line from a input file to determine if an arbitrary words is used in each of the lines. I have read the file in and used getline to store each line in a string. However, Im not sure how to then loop through the string to see if the word is there? Do I have to break the string down and store in a vector? The code so far is:
Code:
cout << "Enter file name: ";
string name;
cin >> name;
ifstream ist(name.c_str());
cout << "Enter a word to search for: ";
string word;
cin >> word;
string s;
while(!ist.eof()){
getline(ist,s);
}
Thanks.