计161_Problem : 字符串操作二(串)

来源:互联网 发布:雪人翻译软件下载 编辑:程序博客网 时间:2024/05/21 09:26
/*Description输入一行字符串(只包含字母),截取最后一位放首位,然后其它的取每一位给asc码+3 。测试数据有多组,一次性输入与输出。InputOutputSample InputasdfawxzSample Outputfdvgzdz{HINT*/#include <stdio.h>#include <stdlib.h>#include<string.h>int main(){    char str[100];    int i;    int b;    char c;    while(scanf("%s",str)!=EOF)    {        b=strlen(str);        c=str[b-1];        for(i=b-1;i>0;i--)            str[i]=str[i-1]+3;        str[0]=c;        puts(str);    }        return 0;}
运行结果:
0 0