求助qwq爆0我太low了

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

SIXIANG32 @ 2020-03-16 09:29:58

#include<iostream>
#include<string>
using namespace std;
string s[6][11]={
    {"   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   "}, 
    {"   ","XXX","..X","XXX","XXX","X.X","XXX","XXX","XXX","XXX","XXX"},
    {"   ","X.X","..X","..X","..X","X.X","X..","X..","..X","X.X","X.X"},
    {"   ","X.X","..X","XXX","XXX","XXX","XXX","XXX","..X","XXX","XXX"},
    {"   ","X.X","..X","X..","..X","..X","..X","X.X","..X","X.X","..X"},
    {"   ","XXX","..X","XXX","XXX","..X","XXX","XXX","..X","XXX","XXX"},
};
int main()
{
    int n;
    cin>>n;
    string str;
    cin>>str;
    for(int p=1;p<=5;p++)
    {
        for(int i=0;i<=n-1;i++)
        {
            cout<<s[p][int(str[i]-48)];
            if(i!=0&&i!=n-1)
            cout<<'.';
        }
        cout<<endl;
    }
    return 0;
}

爆0求助那~~~


by SIXIANG32 @ 2020-03-16 09:44:04

@liqingyang 对


by liqingyang @ 2020-03-16 09:44:15

@SIXIANG A了吧?


by SIXIANG32 @ 2020-03-16 09:44:30

@dingcx 谢谢+%%%+ORZ+SrO


by SIXIANG32 @ 2020-03-16 09:44:41

@liqingyang A了


by liqingyang @ 2020-03-16 09:45:10

@SIXIANG 您要是愿意的话可以试试我的方法:

#include<iostream>
#include<string>
using namespace std;
bool ans[10][5][5]=
{
{{1,1,1},{1,0,1},{1,0,1},{1,0,1},{1,1,1}},
{{0,0,1},{0,0,1},{0,0,1},{0,0,1},{0,0,1}},
{{1,1,1},{0,0,1},{1,1,1},{1,0,0},{1,1,1}},
{{1,1,1},{0,0,1},{1,1,1},{0,0,1},{1,1,1}},
{{1,0,1},{1,0,1},{1,1,1},{0,0,1},{0,0,1}},
{{1,1,1},{1,0,0},{1,1,1},{0,0,1},{1,1,1}},
{{1,1,1},{1,0,0},{1,1,1},{1,0,1},{1,1,1}},
{{1,1,1},{0,0,1},{0,0,1},{0,0,1},{0,0,1}},
{{1,1,1},{1,0,1},{1,1,1},{1,0,1},{1,1,1}},
{{1,1,1},{1,0,1},{1,1,1},{0,0,1},{1,1,1}}
};
int n,a[110];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        char ch;
        cin>>ch;
        a[i]=ch-'0';
    }
    for(int i=0;i<5;i++)
    {
        for(int j=0;j<n;j++)
        {
            for(int k=0;k<3;k++)
            {
                cout<<(ans[a[j]][i][k]?"X":".");
            }
            if(j!=n-1)
            {
                cout<<".";
            }
        }
        cout<<endl;
    }
    return 0;
}

by SIXIANG32 @ 2020-03-16 09:45:15

已经AC,感谢所有回复的人。谢谢帮忙。ORZ%%%SRO


by SIXIANG32 @ 2020-03-16 09:45:57

@liqingyang 身为CPP党我要把string传承下去(滑稽滑稽)


by liqingyang @ 2020-03-16 09:46:46

@SIXIANG O(∩_∩)O哈哈~


上一页 |