20分,数字都可以打出来,但还是20分

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

baibaobao666 @ 2023-04-01 12:46:01

#include <iostream>
#include <string>
using namespace std;

string number[105];

string c(string n,int mod)//mod是第几行,n是数字
{
    if(n == "0")
    {
        if(mod == 1 || mod == 5)
        return "XXX";
        if(mod == 2 || mod == 3 || mod == 4)
        return "X.X";
    }
    if(n == "1")
    {
        return "..X";
    }
    if(n == "2")
    {
        if(mod == 1 || mod == 3 || mod == 5)
        return "XXX";
        if(mod == 2)
        return "..X";
        if(mod == 4)
        return "x..";
    }
    if(n == "3")
    {
        if(mod == 1 || mod == 3 || mod == 5)
        return "XXX";
        if(mod == 2 || mod == 4)
        return "..X";
    }
    if(n == "4")
    {
        if(mod == 1 || mod == 2)
        return "X.X";
        if(mod == 3)
        return "XXX";
        if(mod == 4 || mod == 5)
        return "..X";
    }
    if(n == "5")
    {
        if(mod == 1 || mod == 3 || mod == 5)
        return "XXX";
        if(mod == 4)
        return "..X";
        if(mod == 2)
        return "x..";
    }
    if(n == "6")
    {
        if(mod == 1 || mod == 3 || mod == 5)
        return "XXX";
        if(mod == 2)
        return "X..";
        if(mod == 4)
        return "x.x";
    }
    if(n == "7")
    {
        if(mod == 1)
        return "XXX";
        else
        return "..X";
    }
    if(n == "8")
    {
        if(mod == 1 || mod == 3 || mod == 5)
        return "XXX";
        else
        return "X.X";
    }
    if(n == "9")
    {
        if(mod == 1 || mod == 3 || mod == 5)
        return "XXX";
        if(mod == 2)
        return "X.X";
        else
        return "..X";
    }
}

int main()
{
    int a;
    cin >> a;
    string n;
    cin >> n;
    for(int i = 0;i <= a-1;i++)
    {
        number[i+1] = n[i];
    }
    for(int i = 1;i <= 5;i++)
    {
        for(int j = 1;j <= a;j++)
        {
            cout << c(number[j],i);
            if(j != a)
            cout << ".";
        }
        cout << endl;
    }

    return 0;
}

真的不知道该怎么改了 啊啊啊啊啊啊啊啊啊啊啊啊啊啊


by Max6700 @ 2023-04-30 10:20:54

我找到问题了!!!!!!!


by Max6700 @ 2023-04-30 10:21:51

呃……你还要不?


by baibaobao666 @ 2023-04-30 10:38:29

@Max6700 yyy


by baibaobao666 @ 2023-04-30 10:38:44

@Max6700 要


by Max6700 @ 2023-04-30 10:40:05

@baibaobao666

好家伙,隔了那么久还盯着这题

请注意你的大小写(气死个人)


by Max6700 @ 2023-04-30 10:41:03

"2" "5" "6"


by baibaobao666 @ 2023-04-30 10:41:03

?什么意思


by baibaobao666 @ 2023-04-30 10:42:12

@Max6700 什么意思


by Max6700 @ 2023-04-30 10:47:54

@baibaobao666

你看看“2”的地方,那个

       return "x..";

X要大写!!!!!

(5和6也有)

验证码:wejf(微积分)祭


by baibaobao666 @ 2023-04-30 10:49:48

@Max6700 谢谢,AC了,感觉人都懵了,关注你


| 下一页