【 题目描述 】
输入一串字符(长度小于100),将其中的小写字母转换成大写其他不变,再输出
【 输入 】
一行字符串
【 输出 】
转换后的字符串
【 样例输入 】
Welcome to YALI
【 样例输出 】
WELCOME TO YALI
代码参考:
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin,s);
for(int i=0;i<s.size();i++){
if(s[i]>='a'&&s[i]<='z') s[i]=s[i]-32;
}
cout<<s;
return 0;
}
希望对你有帮助。
喜欢就点个赞吧!!!