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 |
Re:愣是不知道哪里错In Reply To:愣是不知道哪里错 Posted by:00108035 at 2004-05-18 17:21:35 上面的是0输出有错,但是改了只有又说表达式有错………… #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<<"-";} cout<<" "; if(j==strlen(n)-1){cout<<" ";cout<<endl;} } 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<<" "; cout<<" "; if(j==strlen(n)-1)cout<<endl; } } for(j=0;j<strlen(n);j++) { if(n[j]=='1'||n[j]=='7'||n[j]=='0') 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<<"-";} cout<<" "; if(j==strlen(n)-1){cout<<" ";cout<<endl;} } 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<<" "; cout<<" "; if(j==strlen(n)-1)cout<<endl; } } 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<<"-";} cout<<" "; if(j==strlen(n)-1){cout<<" ";cout<<endl;} } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator