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 |
我的代码,新手!不知哪里错了,自己能打出来,但是过不了,都是wa啊。麻烦高手帮忙!#include<iostream> using namespace std; int main() { int s,n,i,j,k,m[8],count; while(cin>>s>>n) { if(s==0&&n==0) continue; i=0; count=0; while(n!=0) { count++; m[i]=n%10; n=n/10; i++; } for(i=count-1;i>=0;i--) { if(m[i]==1||m[i]==4) { cout<<" "; for(j=s-2;j>=0;j--) cout<<" "; } else { cout<<" -"; for(j=s-2;j>=0;j--) cout<<"-"; cout<<" "; } } cout<<endl; for(k=1;k<=s;k++) { for(i=count-1;i>=0;i--) { if(m[i]==1||m[i]==2||m[i]==3||m[i]==7) { cout<<" "; for(j=s-2;j>=0;j--) cout<<" "; } else { cout<<"| "; for(j=s-2;j>=0;j--) cout<<" "; } if(m[i]==5||m[i]==6) cout<<" "; else cout<<"| "; } cout<<endl; } for(i=count-1;i>=0;i--) { if(m[i]==1||m[i]==7||m[i]==0) { cout<<" "; for(j=s-2;j>=0;j--) cout<<" "; } else { cout<<" -"; for(j=s-2;j>=0;j--) cout<<"-"; cout<<" "; } } cout<<endl; for(k=1;k<=s;k++) { for(i=count-1;i>=0;i--) { if(m[i]==2||m[i]==6||m[i]==8||m[i]==0) { cout<<"| "; for(j=s-2;j>=0;j--) cout<<" "; } else { cout<<" "; for(j=s-2;j>=0;j--) cout<<" "; } if(m[i]==2) cout<<" "; else cout<<"| "; } cout<<endl; } for(i=count-1;i>=0;i--) { if(m[i]==1||m[i]==4||m[i]==7) { cout<<" "; for(j=s-2;j>=0;j--) cout<<" "; } else { cout<<" -"; for(j=s-2;j>=0;j--) cout<<"-"; cout<<" "; } } cout<<endl<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator