Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大哥们,帮我看一下哪出错啊,输出和题目完全一样#include<stdio.h> #include<string.h> main() {char a[23][96]; char b[8]; int c,i,j; scanf("%d %s",&c,&b); while (c!=0 ) {for(i=0;i<=2*c+2;i++) for(j=0;j<=int(12*strlen(b)-1);j++)a[i][j]=0; for(i=0;i<=int(strlen(b)-1);i++) switch(b[i]) {case'0':{for(j=1;j<=c;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=c+2;j<=2*c+1;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; case'1':{for(j=1;j<=c;j++)a[j][i*(c+2)+c+1]='|'; for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)+c+1]='|'; }break; case'2':{for(j=1;j<=c;j++)a[j][i*(c+2)+c+1]='|'; for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)]='|'; for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[c+1][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; case'3':{for(j=1;j<=c;j++)a[j][i*(c+2)+c+1]='|'; for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)+c+1]='|'; for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[c+1][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; case'4':{for(j=1;j<=c;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)+c+1]='|'; for(j=1;j<=c;j++)a[c+1][i*(c+2)+j]='-'; }break; case'5':{for(j=1;j<=c;j++)a[j][i*(c+2)]='|'; for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)+c+1]='|'; for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[c+1][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; case'6':{for(j=1;j<=c;j++)a[j][i*(c+2)]='|'; for(j=c+2;j<=2*c+1;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[c+1][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; case'7':{for(j=1;j<=c;j++)a[j][i*(c+2)+c+1]='|'; for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)+c+1]='|'; for(j=1;j<=c;j++)a[0][i*(c+2)+j]='-'; }break; case'8':{for(j=1;j<=c;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=c+2;j<=2*c+1;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[c+1][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; case'9':{for(j=1;j<=c;j++){a[j][i*(c+2)]='|';a[j][i*(c+2)+c+1]='|';} for(j=c+2;j<=2*c+1;j++)a[j][i*(c+2)+c+1]='|'; for(j=1;j<=c;j++){a[0][i*(c+2)+j]='-';a[c+1][i*(c+2)+j]='-';a[2*c+2][i*(c+2)+j]='-';} }break; } for(i=0;i<=c*2+2;i++) {for(j=0;j<=int((c+2)*strlen(b)-1);j++) printf("%c",a[i][j]); printf("\n");} scanf("%d %s",&c,&b); }return 1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator