您的位置:首页 > 其它

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

2017-03-24 02:23 776 查看
程序代码:

#include <stdio.h>
#pragma warning (disable:4996)
#include <windows.h>
int main()
{
int num;
while ((num = getchar()) != EOF)
{
if (num >= 'a' && num <= 'z')
{
printf(" %c\n",num-32);
}
else if (num >= 'A' && num <= 'Z')
{
printf(" %c\n", num + 32);
}
else
{
;
}
}
system("pause");
return 0;
}

程序运行结果:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐