2 solutions

  • 0
    @ 2025-3-17 17:59:47
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e2+10;
    char c[N];
    int main()
    {
        cin.getline(c,N);
        int n=strlen(c);
        for(int i=0;i<=n;i++)
        {
            if(c[i]>='a'&&c[i]<='z')
            {
                c[i]=c[i]-'a'+'A';
            }
        }
        cout<<c;
        return 0;
    }
    

【例】将字符串中的小写字母转换成大写字母

Information

ID
915
Time
1000ms
Memory
256MiB
Difficulty
1
Tags
(None)
# Submissions
70
Accepted
34
Uploaded By