#include<iostream>// cheng da cai zi 11.14 using namespace std; int main() { int i; int j; int k; int size; int num; int digit_array[8]; for(i=0;i<8;i++) digit_array[i]=-1; while(1){ cin>>size; if(size==0) break; cin>>num; i=0; if(num==0) { digit_array[0]=0; i++; } else while(num) { digit_array[i]=num%10; num/=10; i++; } ////////////////////////////////////////////////////第一个横着的部分! A1; num=i; for(i=num-1;i>=0;i--)//模块 { cout<<' '; switch(digit_array[i]) { case 1:for(k=0;k<size;k++) cout<<" ";break; case 2:for(k=0;k<size;k++) cout<<"-";break; case 3:for(k=0;k<size;k++) cout<<"-";break; case 4:for(k=0;k<size;k++) cout<<" ";break; case 5:for(k=0;k<size;k++) cout<<"-";break; case 6:for(k=0;k<size;k++) cout<<"-";break; case 7:for(k=0;k<size;k++) cout<<"-";break; case 8:for(k=0;k<size;k++) cout<<"-";break; case 9:for(k=0;k<size;k++) cout<<"-";break; case 0:for(k=0;k<size;k++) cout<<"-";break; } cout<<' '; if(i!=0) cout<<' '; } cout<<endl; ///////////////////////////////////////////////// 第一个竖着的部分 B1 for(k=0;k<size;k++) { for(i=num-1;i>=0;i--)//模块 { switch(digit_array[i]) { case 1:cout<<' '; for(j=0;j<size;j++) cout<<" "; cout<<"|";break; case 2:cout<<' '; for(j=0;j<size;j++) cout<<' '; cout<<"|";break; case 3:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<'|'; break; case 4:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 5:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<" "; break; case 6:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<" "; break; case 7:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 8:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 9:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 0:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; } if(i!=0) cout<<" "; } cout<<endl; } ///////////////////////////////////////// 第二个横着的部分, A2; for(i=num-1;i>=0;i--)//模块 { cout<<" "; switch(digit_array[i]) { case 1:for(k=0;k<size;k++) cout<<" ";break; case 2:for(k=0;k<size;k++) cout<<"-";break; case 3:for(k=0;k<size;k++) cout<<"-";break; case 4:for(k=0;k<size;k++) cout<<"-";break; case 5:for(k=0;k<size;k++) cout<<"-";break; case 6:for(k=0;k<size;k++) cout<<"-";break; case 7:for(k=0;k<size;k++) cout<<" ";break; case 8:for(k=0;k<size;k++) cout<<"-";break; case 9:for(k=0;k<size;k++) cout<<"-";break; case 0:for(k=0;k<size;k++) cout<<" ";break; } cout<<' '; if(i!=0) cout<<' '; } /////////////////////////////////////第二个竖着的部分,b2; cout<<endl; for(k=0;k<size;k++) { for(i=num-1;i>=0;i--)// 模块 { switch(digit_array[i]) { case 1:cout<<' '; for(j=0;j<size;j++) cout<<" "; cout<<"|";break; case 2:cout<<'|'; for(j=0;j<size;j++) cout<<' '; cout<<" ";break; case 3:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<'|'; break; case 4:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 5:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 6:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 7:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 8:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 9:cout<<" "; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; case 0:cout<<"|"; for(j=0;j<size;j++) cout<<' '; cout<<"|"; break; } if(i!=0) cout<<" "; } cout<<endl; } /////////////////////////////////////////最后一个横着的部分 a3; ///////////////////////////////////////// for(i=num-1;i>=0;i--)//模块 { cout<<" "; switch(digit_array[i]) { case 1:for(k=0;k<size;k++) cout<<" ";break; case 2:for(k=0;k<size;k++) cout<<"-";break; case 3:for(k=0;k<size;k++) cout<<"-";break; case 4:for(k=0;k<size;k++) cout<<" ";break; case 5:for(k=0;k<size;k++) cout<<"-";break; case 6:for(k=0;k<size;k++) cout<<"-";break; case 7:for(k=0;k<size;k++) cout<<" ";break; case 8:for(k=0;k<size;k++) cout<<"-";break; case 9:for(k=0;k<size;k++) cout<<"-";break; case 0:for(k=0;k<size;k++) cout<<"-";break; } cout<<' '; if(i!=0) cout<<' '; } ///////////////////////////////////// cout<<endl; cout<<endl;//输出一个空行 } return 0; }
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com