题解 | #大小写转换#
大小写转换
http://www.nowcoder.com/practice/4e089ee8966a4ed4b306f64e68d45264
#include<stdio.h>
char big_small(char ch){
if((int)ch>=97&&(int)ch<=122){
return (char)((int)ch-32);//小写转换为大写
}
else if((int)ch>=65&&(int)ch<=90){
return (char)((int)ch+32);//大写转换为小写
}
return 0;
}
int main(){
//方法一
char ch;
while((ch=getchar())!=EOF)
{
getchar();
putchar(big_small(ch));
printf("\n");
}
return 0;
}