噢噢噢

目标→黑客←努力 qq群281123877,讨论 奋斗!
2012-12-27 14:30
程序代码:
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
string Upper(string & s);
int main()
{
cout<<"Enter a string (q to quit): ";
string str;
getline(cin,str);
Upper(str); //只改了这里到
while(str!="Q")
{
cout<<str<<endl;
cout<<"Next string (q to quit): ";
getline(cin,str);
Upper(str);
} //这里。目测可行。
cout<<"Bye.\n";
return 0;
}
string Upper(string &s)
{
char *pStr = (char *)s.c_str();
while(*pStr)
{
*pStr = toupper(*pStr);
pStr++;
}
return s;
}
2012-12-31 01:27
2013-01-02 00:39