~cpp
#include <iostream>
using namespace std;
const int MAX_TESTCASE = 10;
int testCase = 0;
int s[MAX_TESTCASE] = {0,};
char n[MAX_TESTCASE][10];
bool pattern[10][7] = {
{1,1,1,0,1,1,1}, //0
{0,0,1,0,0,1,0},//1
{1,0,1,1,1,0,1},//2
{1,0,1,1,0,1,1},//3
{0,1,1,1,0,1,0},//4
{1,1,0,1,0,1,1},//5
{1,1,0,1,1,1,1},//6
{1,1,1,0,0,1,0},//7
{1,1,1,1,1,1,1},//8
{1,1,1,1,0,1,1},//9
};
void input()
{
cin >> s[testCase] >> n[testCase];
//s[testCase] = 2;
//strcpy(n[testCase], "12345");
while(s[testCase] != 0 && n[testCase] != 0)
{
testCase++;
cin >> s[testCase] >> n[testCase];
//s[testCase] = 0;
//strcpy(n[testCase], "0");
}
}
void drawHorizon(int t, int k, int patNum)
{
cout << " ";
for(int j = 0; j < s[t]; j++)
{
char temp = n[t][k];
if(pattern[atoi(&temp)][patNum] != 0)
cout << "-";
else
cout << " ";
}
cout << " ";
cout << " ";
}
void drawVertical(int t, int k, int patNum1, int patNum2)
{
char temp = n[t][k];
if(pattern[atoi(&temp)][patNum1] != 0)
cout << "|";
else
cout << " ";
for(int j = 0; j < s[t]; j++)
{
cout << " ";
}
temp = n[t][k];
if(pattern[atoi(&temp)][patNum2] != 0)
cout << "|";
else
cout << " ";
cout << " ";
}
void output()
{
for(int t = 0; t < testCase; t++)
{
int k=0;
while(strcmp(&n[t][k], "") != 0)
{
//1st
drawHorizon(t, k, 0);
k++;
}
cout << endl;
for(int temp_s = 0; temp_s < s[t]; temp_s++ )
{
k=0;
while(strcmp(&n[t][k], "") != 0)
{
//2st
drawVertical(t, k,1,2);
k++;
}
cout << endl;
}
k=0;
while(strcmp(&n[t][k], "") != 0)
{
//3st
drawHorizon(t, k, 3);
k++;
}
cout << endl;
for(temp_s = 0; temp_s < s[t]; temp_s++ )
{
k=0;
while(strcmp(&n[t][k], "") != 0)
{
//4st
drawVertical(t, k,4,5);
k++;
}
cout << endl;
}
k=0;
while(strcmp(&n[t][k], "") != 0)
{
//5st
drawHorizon(t, k, 6);
k++;
}
cout << endl;
}
}
int main()
{
input();
output();
return 0;
}