编写一个程序,可以一直接收键盘字符,如果是小写字符就输出对应的大写字符,如果接收的是大写字符,就输出对应的小写字符,如果是数字不输出。

来源:互联网 发布:smali文件转java 编辑:程序博客网 时间:2024/05/21 08:45
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<windows.h>
#include<string.h>


int main()
{
char ch = 'a';
printf("请输入:");
flag: scanf("%c", &ch);


if ((ch >= 97) && (ch <= 123))
{
ch = ch - 32;
printf("%c\n", ch);
system("pause");
return 0;
}
else if ((ch >= 65) && (ch <= 91))
{
ch = ch + 32;
printf("%c\n", ch);
system("pause");
return 0;
}
else
printf("输入错误,请重新输入:");
goto flag;
system("pause");
return 0;
}
阅读全文
0 0