模拟.详细见代码:
#include<iostream>
#include<cstring>
using namespace std;
char a[7][10]=
{{'-',' ','-','-',' ','-','-','-','-','-'},
{'|',' ',' ',' ','|','|','|',' ','|','|'},
{'|','|','|','|','|',' ',' ','|','|','|'},
{' ',' ','-','-','-','-','-',' ','-','-'},
{'|',' ','|',' ',' ',' ','|',' ','|',' '},
{'|','|',' ','|','|','|','|','|','|','|'},
{'-',' ','-','-',' ','-','-',' ','-','-'}};
int s;
char c[10];
int main()
{
while(scanf("%d%s",&s,c)!=EOF&&(s||strcmp(c,"0")!=0))
{
int i,j,k;
int len=strlen(c);
for(j=0;j<len;j++)
{
printf(" ");
for(k=1;k<=s;k++)
printf("%c",a[0][c[j]-48]);
printf(" ");
if(j==len-1) printf("\n");
else printf(" ");
}
for(i=1;i<=s;i++)
{
for(j=0;j<len;j++)
{
printf("%c",a[1][c[j]-48]);
for(k=1;k<=s;k++)
printf(" ");
printf("%c",a[2][c[j]-48]);
if(j==len-1) printf("\n");
else printf(" ");
}
}
for(j=0;j<len;j++)
{
printf(" ");
for(k=1;k<=s;k++)
printf("%c",a[3][c[j]-48]);
printf(" ");
if(j==len-1) printf("\n");
else printf(" ");
}
for(i=1;i<=s;i++)
{
for(j=0;j<len;j++)
{
printf("%c",a[4][c[j]-48]);
for(k=1;k<=s;k++)
printf(" ");
printf("%c",a[5][c[j]-48]);
if(j==len-1) printf("\n");
else printf(" ");
}
}
for(j=0;j<len;j++)
{
printf(" ");
for(k=1;k<=s;k++)
printf("%c",a[6][c[j]-48]);
printf(" ");
if(j==len-1) printf("\n");
else printf(" ");
}
printf("\n");
}
return 0;
}
posted on 2010-08-13 10:52
wuxu 阅读(134)
评论(0) 编辑 收藏 引用 所属分类:
模拟