题解 | #简单密码#

简单密码

http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac

#include<stdio.h>
#include<string.h>
int main()
{
    char str[101]={'\0'};
    while(scanf("%s",str)>0)
    {
        for(int i=0;i<strlen(str);i++)
        {
            if(str[i]>='a'&&str[i]<='c')
                str[i]='2';
            else if(str[i]>='d'&&str[i]<='f')
                str[i]='3';
            else if(str[i]>='g'&&str[i]<='i')
                 str[i]='4';
            else if(str[i]>='j'&&str[i]<='l')
                 str[i]='5';
            else if(str[i]>='m'&&str[i]<='o')
                 str[i]='6';
            else if(str[i]>='p'&&str[i]<='s')
                 str[i]='7';
            else if(str[i]>='t'&&str[i]<='v')
                 str[i]='8';
            else if(str[i]>='w'&&str[i]<='z')
                 str[i]='9';
           else if(str[i]>='A'&&str[i]<='Y')
               str[i]=str[i]+32+1;//把大写字母转化为小写字母的后一位
             else if(str[i]=='Z')
               str[i]='a';//把 Z 转化 a
        }
        printf("%s",str);
    }
}
全部评论

相关推荐

Jcwemz:都快过年了,就没几家真正招的,100个投递两个面试算是正常的了 加上你的简历,其实你不能很好的描述你自己是做什么的 两个月的时间,你就负责到自动化的内容啦?
点赞 评论 收藏
分享
评论
1
2
分享

创作者周榜

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