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 |
runtime errorIn Reply To:我疯了……char x[100]再加上3个整型为什么内存超标?????!!!!!!! Posted by:oldboy at 2004-03-13 14:38:58 > #include<iostream.h> > #include<string.h> > > void main() > { > char num[100]; > int i,sum,a; > > while(strcmp(num,"0")!=0){ > cin>>num; > if (strcmp(num,"0")==0) > break; > if (strlen(num)==1){ > cout<<num<<endl; > continue; > } > sum=0; > for (i=0;i<int(strlen(num));i++) > sum+=num[i]-'0'; > a=100; > while(a>=10){ > a=0; > while(sum!=0){ > a+=sum%10; > sum=sum/10; > } > sum=a; > } > cout<<a<<endl; > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator