0
点赞
收藏
分享

微信扫一扫

A - C语言实验——字符编码

DYBOY 2022-02-13 阅读 202

Description

请将一串长度为5的纯字母文本译成一个密码,密码规律如下:用原来的字母后面的第4个字母代替原来的字母。如C用G代替(文本中不存在W/w、X/x、Y/y、Z/z等字母),最后得到的文本即为密码。

Input

输入一串文本,长度固定为5。

Output

输出对应的密码。格式为:
password is 密码

Sample

Input 

China

Output 

password is Glmre
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){
    char a[6];
    int i = 0;
    gets(a);
    while(i < 5){
        a[i] = a[i] + 4;
        i++;
    }
    printf("password is %s\n", a);
    return 0;
}

举报

相关推荐

0 条评论