以下c++代码中的toupper和tolower并没有起作用?
#include<iostream>#include<string>#include<cctype>usingstd::cout;usingstd::cin;usings...
#include<iostream>
#include<string>
#include<cctype>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main()
{
string test0,test1;
cin >> test0;
test1 = test0;
string::size_type ix(0);
for (; ix < test0.size(); ++ix)
{
toupper(test0[ix]);
}
string::size_type ix1(0);
for (; ix < test0.size(); ++ix1)
{
tolower(test1[ix1]);
}
cout << test0 << endl << test1 << endl;
return 0;
=================================================
输出的是和原来一样的字符串! 展开
#include<string>
#include<cctype>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main()
{
string test0,test1;
cin >> test0;
test1 = test0;
string::size_type ix(0);
for (; ix < test0.size(); ++ix)
{
toupper(test0[ix]);
}
string::size_type ix1(0);
for (; ix < test0.size(); ++ix1)
{
tolower(test1[ix1]);
}
cout << test0 << endl << test1 << endl;
return 0;
=================================================
输出的是和原来一样的字符串! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询