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 |
是你循环的问题吧In Reply To:颇为蹊跷,诸位请看(系统提示:Run-time error) Posted by:2003011475 at 2004-09-09 16:33:53 > #include<iostream.h> > #include<string.h> > #include<stdlib.h> > > char num[200]; > > void main() > { > cin>>num; > while(strcmp(num,"0")!=0) > { > int sum=0; > FIND: > for(int i=0;num[i]!='\0';i++)//这个地方有问题 > sum+=(int(num[i])-int('0')); > if(sum<10) > cout<<sum<<endl; > if(sum>=10) > { > for(int j=0;j<200;j++) > num[j]=0; > itoa(sum,num,10); > sum=0; > goto FIND; > } > for(int j=0;j<200;j++) > num[j]=0; > cin>>num; > } > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator