用ASCII码里面字母的编码,同一团答握个字母的大写举野字母和小写字母的数字编码只相差32。相信你能够编出塌庆来了吧
char bigCode[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char smallCode[27]="abcdefghijklmnopqrstuvwxyz";
void main()
{
char SetCode(char code)
char ch='吵斗哗A';
char newCh=SetCode(ch);
}
char SetCode(char code)
{
if(code>='a'&&code<='z')
{
return bigCode[(code-'a')];
}
else if(code>='A'&&code升行<='Z')
{
return smallCode[(code-'A'销指)];
}
}
# include
using namespace std;
main( )
{
char a, b, c;
cin >> a >> b >> c;
cout <<亏答 char(a - ('A'-'a')) <<销唤慧 endl
<链陵< char(b - ('A'-'a')) << endl
<< char(c - ('A'-'a')) << endl;
}