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> using namespace std; void main() { int t,no; cin>>t>>no; int i,j,k,len; int *store; bool state[10][7]; for(i=0;i<10;i++) for(j=0;j<7;j++) state[i][j]=true; state[0][3]=false; state[1][0]=false; state[1][1]=false; state[1][3]=false; state[1][4]=false; state[1][6]=false; state[2][1]=false; state[2][5]=false; state[3][1]=false; state[3][4]=false; state[4][0]=false; state[4][4]=false; state[4][6]=false; state[5][2]=false; state[5][4]=false; state[6][2]=false; state[7][1]=false; state[7][3]=false; state[7][4]=false; state[7][6]=false; state[9][4]=false; while(t!=0 && no!=0) { for(i=10000000,j=8;i>0;i/=10,j--) { if(no/i>0) { len=j;j--; store=new int[len]; store[0]=no/i; no=no%i; i/=10; j=1; while(j<len) { store[j]=no/i;no=no%i;i/=10;j++; } break; } } //output //0 for(i=0;i<len-1;i++) { cout<<' '; if(state[store[i]][0]) { for(j=0;j<t;j++) cout<<'-'; } else { for(j=0;j<t;j++) cout<<' '; } cout<<' '; cout<<' '; } cout<<' '; if(state[store[i]][0]) { for(j=0;j<t;j++) cout<<'-'; } else { for(j=0;j<t;j++) cout<<' '; } cout<<' '; cout<<endl; //1,2 for(i=0;i<t;i++) { for(j=0;j<len-1;j++) { if(state[store[j]][1]) cout<<'|'; else cout<<' '; for(k=0;k<t;k++) cout<<' '; if(state[store[j]][2]) cout<<'|'; else cout<<' '; cout<<' '; } if(state[store[j]][1]) cout<<'|'; else cout<<' '; for(k=0;k<t;k++) cout<<' '; if(state[store[j]][2]) cout<<'|'; else cout<<' '; cout<<endl; } //3 for(i=0;i<len-1;i++) { cout<<' '; if(state[store[i]][3]) { for(j=0;j<t;j++) cout<<'-'; } else { for(j=0;j<t;j++) cout<<' '; } cout<<' '; cout<<' '; } cout<<' '; if(state[store[i]][3]) { for(j=0;j<t;j++) cout<<'-'; } else { for(j=0;j<t;j++) cout<<' '; } cout<<' '; cout<<endl; //4,5 for(i=0;i<t;i++) { for(j=0;j<len-1;j++) { if(state[store[j]][4]) cout<<'|'; else cout<<' '; for(k=0;k<t;k++) cout<<' '; if(state[store[j]][5]) cout<<'|'; else cout<<' '; cout<<' '; } if(state[store[j]][4]) cout<<'|'; else cout<<' '; for(k=0;k<t;k++) cout<<' '; if(state[store[j]][5]) cout<<'|'; else cout<<' '; cout<<endl; } //6 for(i=0;i<len-1;i++) { cout<<' '; if(state[store[i]][6]) { for(j=0;j<t;j++) cout<<'-'; } else { for(j=0;j<t;j++) cout<<' '; } cout<<' '; cout<<' '; } cout<<' '; if(state[store[i]][6]) { for(j=0;j<t;j++) cout<<'-'; } else { for(j=0;j<t;j++) cout<<' '; } cout<<' '; cout<<endl; cout<<endl; delete []store; cin>>t>>no; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator