关于#c++#的问题,请各位专家解答!

输入一个字符,如果是大写,转换为小写字母,如果是小写字母,转换为大写字母。如果不是字母,输出ASCII码

#include <iostream>
using namespace std;
int main()
{
    char c;
    cin>>c;
    if('a'<=c &&c<='z') {
        c-=32;
        cout <<c<<endl;
    }
    else if('A'<=c &&c<='Z') {
        c+=32;
        cout <<c<<endl;
    }else{
        cout <<c+0<<endl;
    }
    return 0;
}
#include <iostream>
using namespace std;
int main()
{
      char ch;
      cin>>ch;
      if(ch>='a' && ch<='z')
        cout<<(char)(ch-32);
      else if(ch >= 'A' && ch<='Z')
        cout<<(char)(ch+32);
      else
        cout<<(int)ch;
      return 0;
}