64,654
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<vector>
#include<string>
#include <locale>
using namespace std;
void myToUpper(std::string& str, char re)
{
for (size_t i=0; i<str.size(); i++)
{
re = toupper(str[i]);
cout<< re << endl;
}
}
int main()
{
string i;
char n = NULL;
vector<string> vect;
vector<string>::size_type num=0;
cin>>i;
vect.push_back(i);
for(num =0;num!=vect.size();num++)
{
myToUpper(vect[num],n);
//cout<<vect[num];
}
return 0;
}
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
void myToUpper(std::string& str)
{
for (size_t i=0; i<str.size(); i++)
{
str[i] = toupper(str[i]); // 这里的问题
}
}
int main()
{
string i;
vector<string> vect;
vector<string>::size_type num=0;
while(cin>>i)
{
vect.push_back(i);
}
for_each( vect.begin(), vect.end(), myToUpper );
copy( vect.begin(), vect.end(), ostream_iterator<string>(cout, "\n"));
system("PAUSE");
return 0;
}
/*
one
two
^Z
ONE
TWO
请按任意键继续. . .*/