求助

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

ZXmax2005 @ 2024-11-07 18:49:09

感觉想法没问题,但是输出不会解决

#include<bits/stdc++.h>

using namespace std;

const int N = 110;
string num_str[10] = { "XXXX.XX.XX.XXXX","..X..X..X..X..X","XXX..XXXXX..XXX","XXX..XXXX..XXXX","X.XX.XXXX..X..X","XXXX..XXX..XXXX","XXXX..XXXX.XXXX","XXX..X..X..X..X","XXXX.XXXXX.XXXX","XXXX.XXXX..XXXX" };
string a;

int main()
{
    int n;
    cin >> n;
    cin >> a;
    for (int i = 0; i < n-1; i++)
    {
        for (int j = 0; j < 15; j++)
        {
            if (j == 3 || j == 6 || j == 9 || j == 12) cout << endl;
            cout << num_str[a[i] -'0'][j];
        }
        cout << "." << endl;
        cout << "." << endl;
        cout << "." << endl;
        cout << "." << endl;
        cout << "." << endl;

    }
    for (int j = 0; j < 15; j++)
    {
        if (j == 3 || j == 6 || j == 9 || j == 12) cout << endl;
        cout << num_str[a[n-1]-'0'][j];
    }
    system("pause");
    return 0;
}

|