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 <iostream.h> #include <string.h> void main() { int s,k; char* n=new char[100]; for(int i=0;i<100;i++) n[i]='\0'; while(1) { cin>>s; cin>>n; if(s==0)return; if(s==0&&strcmp(n,"0")==0) break; for(int j=0;j<strlen(n);j++) { if(n[j]=='1'||n[j]=='4') for(k=1;k<=s+2;k++) cout<<" "; else {for(int k=1;k<=s+2;k++) if(k==1||k==s+2)cout<<" ";else cout<<"-";} if(j==strlen(n)-1)cout<<endl; else cout<<" "; } for(i=1;i<=s;i++) { for(j=0;j<strlen(n);j++) { if(n[j]=='1'||n[j]=='2'||n[j]=='3'||n[j]=='7') for(k=1;k<=s+2;k++) if(k==s+2)cout<<"|";else cout<<" "; if(n[j]=='5'||n[j]=='6') for(k=1;k<=s+2;k++) if(k==1)cout<<"|";else cout<<" "; if(n[j]=='4'||n[j]=='8'||n[j]=='9'||n[j]=='0') for(k=1;k<=s+2;k++) if(k==1||k==s+2)cout<<"|";else cout<<" "; if(j==strlen(n)-1)cout<<endl; else cout<<" "; } } for(j=0;j<strlen(n);j++) { if(n[j]=='1'||n[j]=='7') for(k=1;k<=s+2;k++) cout<<" "; else {for(int k=1;k<=s+2;k++) if(k==1||k==s+2)cout<<" ";else cout<<"-";} if(j==strlen(n)-1)cout<<endl; else cout<<" "; } for(i=1;i<=s;i++) { for(j=0;j<strlen(n);j++) { if(n[j]=='1'||n[j]=='4'||n[j]=='5'||n[j]=='7'||n[j]=='9'||n[j]=='3') for(k=1;k<=s+2;k++) if(k==s+2)cout<<"|";else cout<<" "; if(n[j]=='2') for(k=1;k<=s+2;k++) if(k==1)cout<<"|";else cout<<" "; if(n[j]=='6'||n[j]=='8'||n[j]=='0') for(k=1;k<=s+2;k++) if(k==1||k==s+2)cout<<"|";else cout<<" "; if(j==strlen(n)-1)cout<<endl; else cout<<" "; } } for(j=0;j<strlen(n);j++) { if(n[j]=='1'||n[j]=='4'||n[j]=='7') for(k=1;k<=s+2;k++) cout<<" "; else {for(int k=1;k<=s+2;k++) if(k==1||k==s+2)cout<<" ";else cout<<"-";} if(j==strlen(n)-1)cout<<endl; else cout<<" "; } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator