#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int isBigLetter(ch) {
return ch <= 'Z'&&ch >= 'A';
}
int isSmallLetter(ch) {
return ch <= 'z'&&ch >= 'a';
}
int main() {
char ch;
while (1) {
ch = getchar();
if (isSmallLetter(ch)) {
putchar(ch & ~(1 << 5));
}
else if (isBigLetter(ch)) {
putchar(ch | 1 << 5);
}
else if (isalnum(ch)) {
//do nothing
}
else if (ch == '$') {
break;
}
else {
putchar(ch);
}
}
system("pause");
return 0;
}
编写一个程序,可以一直接收键盘字符, 如果是小写字符就输出对应的大写字符, 如果接收的是大写字符,就输出对应的小写字符, 如果是数字不输出。
最新推荐文章于 2022-09-13 20:59:00 发布