这道题可以通过直接一行一行输出
大致可以将数字分为五部分
顶部,顶部下方,中部,中部下方,底部
代码

char top[10]={'-',' ','-','-',' ','-','-','-','-','-'};//如果有就为横线,没有就为空格,如“1”和“0”
char left_top[10]={'|',' ',' ',' ','|','|','|',' ','|','|'};
char right_top[10]={'|','|','|','|','|',' ',' ','|','|','|'};
char mid[10]={' ',' ','-','-','-','-','-',' ','-','-'};
char left_bottom[10]={'|',' ','|',' ',' ',' ','|',' ','|',' '};
char right_bottom[10]={'|','|',' ','|','|','|','|','|','|','|'};
char bottom[10]={'-',' ','-','-',' ','-','-',' ','-','-'};

然后,就可以分为五部分输出了
输出横线的函数

void printt(char a[])
{
for(int i=0;i<x;i++)
{
if(i==0)
cout<<" ";//输出每个数字前的空格
else
cout<<" ";//对齐
for(int j=0;j<k;j++)
cout<<a[num[i]-'0'];//每个数字输出K根横线
cout<<" ";
}
cout<<endl;//一定要换行
}

输出竖线的函数

void print(int a,char a1[],char b[])
{
if(a==0)
return;
else
{
for(int j=0;j<x;j++)
{
if(j!=0)
cout<<" ";//输出每个数字前的空格
cout<<a1[num[j]-'0'];//输出左边竖线
for(int i=0;i<k;i++)
cout<<" ";//输出每个数字两边的竖线之间的空格
cout<<b[num[j]-'0'];//输出右边横线
}
cout<<" ";
cout<<endl;//换行
print(a-1,a1,b);//重复输出K次
}
}

最后附上完整代码

#include<iostream>
#include<cstring>
#include<iomanip>
using namespace std;
char num[260];
char top[10]={'-',' ','-','-',' ','-','-','-','-','-'};
char left_top[10]={'|',' ',' ',' ','|','|','|',' ','|','|'};
char right_top[10]={'|','|','|','|','|',' ',' ','|','|','|'};
char mid[10]={' ',' ','-','-','-','-','-',' ','-','-'};
char left_bottom[10]={'|',' ','|',' ',' ',' ','|',' ','|',' '};
char right_bottom[10]={'|','|',' ','|','|','|','|','|','|','|'};
char bottom[10]={'-',' ','-','-',' ','-','-',' ','-','-'};
int x,k;

void space(int a)
{

}

void print(int a,char a1[],char b[])
{
if(a==0)
return;
else
{
for(int j=0;j<x;j++)
{
if(j!=0)
cout<<" ";
cout<<a1[num[j]-'0'];
for(int i=0;i<k;i++)
cout<<" ";
cout<<b[num[j]-'0'];
}
cout<<" ";
cout<<endl;
print(a-1,a1,b);
}
}

void printt(char a[])
{
for(int i=0;i<x;i++)
{
if(i==0)
cout<<" ";
else
cout<<" ";
for(int j=0;j<k;j++)
cout<<a[num[i]-'0'];
cout<<" ";
}
cout<<endl;
}

int main()
{
cin>>k;//输入大小
cin>>num;//输入字符串
x=strlen(num);
printt(top);//打印顶部横线
print(k,left_top,right_top);//打印顶部下方的竖线
printt(mid);//打印中间的横线
print(k,left_bottom,right_bottom);//打印中部下方的竖线
printt(bottom);//打印底部的竖线
return 0;
}

如有错误,请指出