0
"123"
검색을위한 정보를 "topic not supported"
으로 표시하지 않고 첫 번째 검색에서 "decimals"
을 표시 할 수 있도록 다음 문을 분리하면 어떻게 될까요?나는이 진술을 어떻게 분리합니까?
string sentence;
string search;
string sentence2;
string search2;
size_t position2;
cin >> choosetopic;
switch (choosetopic)
{
case 1:
cout << "Please enter the name of the topic you need help with.";
cin >> sentence;
system("cls");
cout << "Topic: " << sentence << endl;
cout << "\n";
size_t pos;
search = "Decimals";
search = "decimals";
search = "decimal";
search = "Decimal";
pos = sentence.find(search);
if (pos != std::string::npos)
cout << "blah blah" << std::endl;
else
cout << "Topic not yet supported, please try another. View 'Help' on the main menu to see supported topics. " << endl;
cin >> sentence;
cout << "Topic: " << sentence << endl;
cout << "\n";
search = "123";
pos = sentence.find(search);
if (pos != std::string::npos)
cout << "12313" << std::endl;
else
cout << "Topic not yet supported, please try another. View 'Help' on the main menu to see supported topics. " << endl;
search''에 그 과제는'여러 문자열을 검색하는 전화 find' 추가하거나 발생하지 않습니다. –
어떻게 이런 일을 할 수 있습니까? – James941
처음에는 "소수"를 찾으면 "십진수"를 찾으므로 후자는 중복됩니다. – chris