源码:
方法一
#include<stdio.h>
int main()
{
char a;
printf("请输入一个字母:");
scanf("%c", &a);
if (a <= 91)
{
a = a + 32;
printf("该子母的小写形式为:%c\n", a);
}
(a>91);
{
a = a - 32;
printf("该子母的大写形式为:%c\n", a);
getchar();
getchar();
}
return 0;
}
方法二
#include<stdio.h>
int main()
{
char ch='a';char big;char small;
scanf("%c", &ch);
big=ch>='a'&&ch<='z'?ch=ch-32:ch;
printf("big=%c\n",big);
small=ch<'a'?ch=ch+32:ch;
printf("small=%c\n",small);
getchar();
getchar();
return 0;
}