C++ 算法提高 字母大小写转换

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    char s,t;
    cin>>s;
    if(s-'A'>=0&&s-'Z'<=0)
    {
        t=s+32;
        cout<<t;
        return 0;    
    }
    else if(s>='a'&&s<='z')
    {
        t=s-32;
        cout<<t;
        return 0;
    }
    else;
    cout<<s;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_47991812/article/details/108057181