Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <string>
#include <iostream>
#include <cstring>
using namespace std;
char map [10][7] = {
/* 0 */ '-','|','|',' ','|','|','-',
/* 1 */ ' ',' ','|',' ',' ','|',' ',
/* 2 */ '-',' ','|','-','|',' ','-',
/* 3 */ '-',' ','|','-',' ','|','-',
/* 4 */ ' ','|','|','-',' ','|',' ',
/* 5 */ '-','|',' ','-',' ','|','-',
/* 6 */ '-','|',' ','-','|','|','-',
/* 7 */ '-',' ','|',' ',' ','|',' ',
/* 8 */ '-','|','|','-','|','|','-',
/* 9 */ '-','|','|','-',' ','|','-',
};
char display[25][139];
void draw_horizontal (int i, int j, int s, char symb)
{
for (int k = j; k <= j+s-1; ++k)
display[i][k] = symb;
}
void draw_vertical (int i, int j, int s, char symb)
{
for (int k = i; k <= i+s-1; ++k)
display[k][j] = symb;
}
void draw_digit (int i, int s, char c)
{
int d = c - '0';
draw_horizontal (0, i+1, s, map[d][0]);
draw_vertical (1, i, s, map[d][1]);
draw_vertical (1, i+s+1, s, map[d][2]);
draw_horizontal (s+1, i+1, s, map[d][3]);
draw_vertical (s+2, i, s, map[d][4]);
draw_vertical (s+2, i+s+1, s, map[d][5]);
draw_horizontal (2*s+2, i+1, s, map[d][6]);
}
int main()
{
int s;
string nr;
for (cin >> s >> nr; s; cin >> s >> nr)
{
memset (display, ' ', sizeof(display));
for (int i = 0; i < nr.size(); ++i)
draw_digit (i*(s+3), s, nr[i]);
for (int i = 0; i < 2*s+3; ++i)
display[i][nr.size() * (s+3) - 1] = '\0';
for (int i = 0; i < 2*s+3; ++i)
cout << display[i] << '\n';
cout << '\n';
}
return 0;
}