#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main(int argc, const char *argv[])
{
char c;
cout<<"please enter a letter:";
cin>>c;
cout<<"c:"<<c<<endl;
if (c >= 'a' && c <= 'z')
{
//c=c+('A'-'a');
c=c-32;
cout<<"stob:"<<c<<endl;
}
else if (c >= 'A' && c <= 'Z')
{
//c=c-('A'-'a');
c=c+32;
cout<<"btos:"<<c<<endl;
}
else
{
cout<<"enter error!"<<endl;
}
return 0;
}
C++ 大小写字母转换
于 2022-08-20 09:24:36 首次发布