文章を調べて、文字や単語を見つけたら表示するプログラムを作りたいです。
最初の文字/単語を見つけるとすぐに停止するプログラムを考えてみてください。
string test("This is sentense i would like to find ! "); //his is sentense to be searched
string look; // word/char that i want to search
cin >> look;
for (i = 0; i < test.size(); i++) //i<string size
{
unsigned searcher = test.find((look));
if (searcher != string::npos) {
cout << "found at : " << searcher;
}
}