转自:http://www.vimer.cn/2009/11/string%E8%BD%AC%E5%8C%96%E5%A4%A7%E5%B0%8F%E5%86%99c.html
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
using namespace std;
int main() {
string s = "Clare";
// toUpper
transform(s.begin(), s.end(), s.begin(), ::toupper);
// toLower
//transform(s.begin(),s.end(),s.begin(), ::tolower);
cout << s << endl;
}
#include <stdio.h>
#include <ctype.h>
int main() {
char s[] = "Clare";
int i = -1;
while(s[i++])
s[i] = toupper(s[i]);
// s[i] = tolower(s[i]);
puts(s);
}