if U have a file called f.txt for example U can make th following
freopen("f.txt","rt",stdin);
string s = "";
getline(cin,s); // this will read a line from the file
//now to search for a word use
s.strstr("Ur word"); // will return -1 in case the string is not found and the index of the start of the word otherwise
Regards,
strawberry
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment