题解 | #大小写转换#

大小写转换

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;
}
全部评论

相关推荐

06-11 17:39
门头沟学院 Java
小呆呆的大鼻涕:卧槽,用户彻底怒了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务