Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

颇为蹊跷,诸位请看(系统提示:Run-time error)

Posted by 2003011475 at 2004-09-09 16:33:53 on Problem 1519
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator