タイトルはあまり有益ではありませんが、基本的にはtxtファイルに対してチェックを行い、探しているものが含まれている単語を探します。C++ else文字列内の文字の場合
次のコードは、それを正しく正確に実行します。しかし!
void qu()
{
for (Word word : word2)
{
string uq = word.getWord();
if (uq.find("qa") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qb")!= std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qc") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qd") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qe") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qf") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qg") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qh") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qi") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qj") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qk") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("ql") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qm") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qn") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qo") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qp") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qq") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qr") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qs") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qt") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qv") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qw") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qx") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qy") != std::string::npos)
{
cout << uq << '\n';
}
else if (uq.find("qz") != std::string::npos)
{
cout << uq << '\n';
}
}
}
もっときちんとした方法でやりたいと思います。
誰かが正しい方向に私を指すことができる場合は、cplusplusのrefernceのリンクや他の素晴らしいドキュメントがあります。
答えは実際にあなたの質問に答えている場合は、それを回答としてマークしてください。あなたの質問に答えをコピーしないでください!それはスタックオーバーフローの仕組みではありません... –
コードが動作する場合は、それ自身のサイトを持つ[コードレビュー](https://codereview.stackexchange.com/)のケースの多くです。 –