You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
571 B
22 lines
571 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
string s;
|
|
cin >> s;
|
|
//方式1
|
|
for (int i = 0; i < s.size(); i++)
|
|
printf("%c", toupper(s[i]));
|
|
printf("\n");
|
|
//方式2
|
|
for (int i = 0; i < s.size(); i++)
|
|
printf("%c",
|
|
// s[i] >= 'a' && s[i] <= 'z' ? s[i] - 'a' + 'A' : s[i]);
|
|
s[i] >= 'a' && s[i] <= 'z' ? s[i] - 32 : s[i]);
|
|
printf("\n");
|
|
//方式STL
|
|
//transform(s.begin(), s.end(), s.begin(), ::toupper);
|
|
//printf("%s\n", s.c_str());
|
|
return 0;
|
|
} |