使用以下控制台应用程序我将每个字符串转换为大写字母.但输出中的字符串值保持不变.我在这做错了什么.此外,任何有效这方面的帮助将不胜感激.谢谢你的帮助.
int main()
{
vector<string> svec, svec_out;
string word;
int run;
cout << "Press 0 to quit giving input string" << endl;
while(1)
{
cin >> word;
svec.push_back(word);
cin >> run;
if (!run)
break;
}
cout << "converting to upper case... " << endl;
int i;
for (i = 0; i!=svec.size(); ++i)
{
word = svec[i];
for (string::size_type j=0; j < word.size(); ++j)
{
toupper(word[j]);
}
svec_out.push_back(word);
}
for ( i = 0; i<svec_out.size(); i++)
cout << svec_out[i] << endl; …Run Code Online (Sandbox Code Playgroud) c++ ×1