求助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 liqingyang @ 2020-03-16 09:31:25

@SIXIANG 我看看


by liqingyang @ 2020-03-16 09:34:02

@SIXIANG 您前面不能有空格呀


by liqingyang @ 2020-03-16 09:34:27

@SIXIANG 建议用三维字符数组


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

@liqingyang 我从1开始的呀


by SIXIANG32 @ 2020-03-16 09:34:56

@liqingyang 哦懂了谢谢


by SIXIANG32 @ 2020-03-16 09:35:16

@liqingyang 依然保龄


by liqingyang @ 2020-03-16 09:35:51

#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][str[i]-47];//int不需要吧?
            if(i!=0&&i!=n-1)
            cout<<'.';
        }
        cout<<endl;
    }
    return 0;
}

by SIXIANG32 @ 2020-03-16 09:36:37

@liqingyang 继续保龄


by liqingyang @ 2020-03-16 09:37:36

@SIXIANG 您多少岁呀?


by SIXIANG32 @ 2020-03-16 09:38:02

@liqingyang 10岁


| 下一页