编写程序可一直接收键盘字符,输入小写字符输出大写字符;输入大写字符输出小写字符;输入数字不输出;

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main()
{
	char str1[] = "abcdefghijklmnopwrstuvwxyz";
	char str2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int x = 0;
	while (1) {
		scanf("%c", &x);
		for (int i = 0; i < 26; ++i) {
			if (x == str1[i]) {
				printf("%c\n", str2[i]);
			}
			else if (x == str2[i]) {
				printf("%c\n", str1[i]);
			}
			else
				;
		}
	}
    system("pause");
    return 0;
 }
    

猜你喜欢

转载自blog.csdn.net/qq940051592/article/details/84777406