#include<stdio.h>
#include<stdlib.h>
//英文字母大小写转换
void main()
{
char ch;
start1:printf("\n请输入一个英文字母:");
start2:ch = getchar();//获取一个字符输入
printf("\n所输入的字符是%c,", ch);//确认输入的字符
if (ch >= 65 && ch <= 90)//A'的编号是65,'Z'的编号90
{
printf("其小写是%c。", ch + 32);
goto start1;
}
else if (ch >= 97 && ch <= 122)//'a'的编号97,'z'的编号是122
{
printf("其大写是%c。", ch - 32);
goto start1;
}
else
{
printf("输入错误。请重新输入一个英文字母:");
goto start2;
}
system("pause");
}
#include<stdlib.h>
//英文字母大小写转换
void main()
{
char ch;
start1:printf("\n请输入一个英文字母:");
start2:ch = getchar();//获取一个字符输入
printf("\n所输入的字符是%c,", ch);//确认输入的字符
if (ch >= 65 && ch <= 90)//A'的编号是65,'Z'的编号90
{
printf("其小写是%c。", ch + 32);
goto start1;
}
else if (ch >= 97 && ch <= 122)//'a'的编号97,'z'的编号是122
{
printf("其大写是%c。", ch - 32);
goto start1;
}
else
{
printf("输入错误。请重新输入一个英文字母:");
goto start2;
}
system("pause");
}