qq_45735316 2020-04-18 22:10 采纳率: 94.1%
浏览 280
已采纳

这段代码有错误吗?输出结果是正确的

图片说明
图片说明

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 101
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    char a[N]={0};
    char b[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    int i=0,n=0;
    while((scanf("%c",&a[i]))!=EOF)
    {
        i++;
    }
    n=strlen(a);
    for(i=0;i<n-1;i++)
    {
        printf("%c",b[(((int)(a[i]-'a')%26)+3)]);
    }
    return 0;
}
  • 写回答

1条回答 默认 最新

  • threenewbee 2020-04-19 11:15
    关注

    应该是对的
    http://www.metools.info/code/c70.html 这里有个网站
    你可以把你的程序的输出和他对照
    我测试了一些,没有发现不同

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 chaquopy python 安卓
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题