#include <stdio.h>
#include <string.h>
#define MAX 20
int main(int argc, const char * argv[]) {
char s[MAX];
int i;
scanf("%s",s);
//大小写转换
for (i = 0; i< strlen(s); ++i) {
if ((‘a‘<=s[i])&&(s[i]<=‘z‘)) {
s[i]=s[i]-32;
}
else if ((‘A‘<=s[i])&&(s[i]<=‘Z‘)){
s[i]=s[i]+32;
}
}
//打印转换后的字符
printf("%s\n",s);
return 0;
}
原文:http://www.cnblogs.com/123qw/p/4382206.html