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 |
run time error!!!who can help me!!!#include<iostream.h> #include<math.h> int n,i,j,s; int *m; void main() { for(;;) { cin>>n; if(n==0) break; for(;;) { for(i=0;;i++) { if(n/(long)pow(10,i)==0) break; } m=new int[i]; for(j=0;j<i;j++) { m[j]=n/(int)pow(10,i-j-1); n-=m[j]*(int)pow(10,i-j-1); } s=0; for(j=0;j<i;j++) s+=m[j]; if(s/10==0) { cout<<s<<endl; break; } else n=s; delete [] m; } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator