qq_51377167 2022-10-29 07:45 采纳率: 100%
浏览 61
已结题

怎么用c做这条题,已经困扰我两天了

  • 写回答

2条回答 默认 最新

  • 我不叫ano 2022-10-30 20:36
    关注

    是的,我来了!

    
    #define _CRT_SECURE_NO_WARNINGS 1
    #include <stdio.h>
    void Encrypt(char* a, char* b)
    {
        int i = 0;
        printf("加密后的结果为:");
        for (i = 0; i < 6; i++)
        {
            char y = 0;
            int x = *(a + i) + *(b + i);
            if (x <= 127)
            {
                y = (char)x;
            }
            else
            {
                y = (char)(x - 127);
            }
            printf("%c ", y);
        }
        printf("\n");
    }
    int main()
    {
        char text[7] = { 0 };
        char password[7] = { 0 };
        printf("请输入6个字符作为文本>");
        scanf("%c %c %c %c %c %c", &text[0], &text[1], &text[2], &text[3], &text[4], &text[5]);
        printf("请输入6个字符作为密码>");
        int bin = getchar();
        scanf("%c %c %c %c %c %c", &password[0], &password[1], &password[2], &password[3], &password[4], &password[5]);
        Encrypt(text,password);
        return 0;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月7日
  • 已采纳回答 10月30日
  • 创建了问题 10月29日

悬赏问题

  • ¥15 esp32cam串口图传
  • ¥15 C# 用partial定义部分类无法快速预览代码
  • ¥15 fastreport 代码无法设置最后一页横线不显示
  • ¥15 stm32u535芯片usb hid custom类接收数据有问题
  • ¥15 ue5.3 pico打包失败 求帮助
  • ¥15 请教,这是用chatgpt写的CAD LISPD脚本,需求是画一个由双直线组成的矩形
  • ¥50 微信小程序 成功包奶茶啊
  • ¥15 计算机博弈的六子棋代码
  • ¥15 在Fetch API中传送的参数为何不起作用?
  • ¥15 问题遇到的现象和发生背景 360导航页面千次ip是20元,但是我们是刷量的 超过100ip就不算量了,假量超过100就不算了 这是什么逻辑呢 有没有人能懂的 1000元红包感谢费