洛谷-P5733 【深基6.例1】自动修正

洛谷-P5733 【深基6.例1】自动修正

原题链接:https://www.luogu.com.cn/problem/P5733


题目描述

大家都知道一些办公软件有自动将字母转换为大写的功能。输入一个长度不超过 100 且不包括空格的字符串。要求将该字符串中的所有小写字母变成大写字母并输出。

输入格式

输出格式

输入输出样例

输入 #1

Luogu4!

输出 #1

LUOGU4!

C++代码

#include <iostream>
#include <cstring>
using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i=0; i<s.size(); ++i)
        if (s[i] >= 'a' && s[i] <= 'z')
            s[i] -= 32;
    cout << s << endl;
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/yuzec/p/13383623.html