出来结果一样,但是一直WA

P5730 【深基5.例10】显示屏

道爷2000 @ 2020-10-08 00:29:33

直接上代码

#include<stdio.h>
int main()
{
    char fuck[10][15]={'X','X','X','X','.','X','X','.','X','X','.','X','X','X','X',
                       '.','.','X','.','.','X','.','.','X','.','.','X','.','.','X',
                       'X','X','X','.','.','X','X','X','X','X','.','.','X','X','X',
                       'X','X','X','.','.','X','X','X','X','.','.','X','X','X','X',
                       'X','.','X','X','.','X','X','X','X','.','.','X','.','.','X',
                       'X','X','X','X','.','.','X','X','X','.','.','X','X','X','X',
                       'X','X','X','X','.','.','X','X','X','X','.','X','X','X','X',
                       'X','X','X','.','.','X','.','.','X','.','.','X','.','.','X',
                       'X','X','X','X','.','X','X','X','X','X','.','X','X','X','X',
                       'X','X','X','X','.','X','X','X','X','.','.','X','X','X','X'
    };
    int num,i,j,k;
    int a[100];
    char c;
    scanf("%d",&num);
    getchar();
    for(i=0;i<num;i++)
    {
        c=getchar();
        a[i]=c-'0';
    }
    for(i=0;i<5;i++)
    {
        for(j=0;j<num;j++)
        {
            for(k=0;k<3;k++)
            {
                printf("%c",fuck[a[j]][3*i+k]);
            }
            if(j==num-1);
            else{
                printf(".");
            }

        }
        printf("\n");
    }
    return 0;
}

fuck数组保存的是0-9的点阵,fuck[0][15]保存的就是0的点阵,就是将竖向的横向化储存。 效果如下 下载的数据 ![](E:\data\Github-----\屏幕截图 2020-10-08 002529) 运行结果 ![](E:\data\Github-----\屏幕截图 2020-10-08 002611.jpg)


by jingkongwanglimiaoa @ 2020-10-08 00:31:52

数组名危


by 可爱 @ 2020-10-08 06:51:32

等我有钱了,一定要买一台能看别人电脑文件的电脑!


by Eon_Sky @ 2020-10-08 08:19:49

等我有钱了,一定要买一台能看别人电脑文件的电脑!


by 滑大稽 @ 2020-10-08 08:22:18

等我有钱了,一定要买一台能看别人电脑文件的电脑!


by justinjia @ 2020-11-02 19:14:23

@道爷2000 第19行的getchar();是什么意思?我记得getchar();不能直接用,要写成变量名=getchar();的形式啊。


by 37度_new @ 2020-11-18 23:48:43

我和你的代码差不多,后来发现把: scanf("%d",&num); getchar(); 改为: scanf("%d\n", &num); 就全对了


|