【C练】编写一个程序,可以一直接收键盘字符

如果是小写字符就输出对应的大写字符,
如果接收的是大写字符,就输出对应的小写字符,
如果是数字不输出。

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main()
{
	char input = 0,output;
	printf("请输入字母:");
	while ((input = getchar()) != EOF)
	{
		
		if (input >= 'a' && input <=  'z')
		{
			printf("output =%c", input - 32);
		}
		if (input >= 'A' && input <= 'Z')
		{
			printf("output =%c", input + 32);
		}
		if (input >= '0'&& input <= '9')
		{
			continue;
		}
	}
	printf("\n");
	system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/LXL7868/article/details/88777923