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

为什么我的总是RUNTIME ERROR?本机运行没有问题啊

Posted by weiguo at 2005-11-20 16:21:56 on Problem 1003
#include <string>
#include <iostream>

using namespace std;

int main()
{
	int numOfCards;
	float overHangLen;
	int numOfCases = 0;
	char floatString[20];
	char result[100];
	result[0] = '\0';
	while(1)
	{
		cin >> overHangLen;
		if( overHangLen != 0 )
			numOfCases++;
		else
		{
			if( numOfCases == 0 )
				exit(0);
			else 
				break;
		}
		numOfCards = 0;
		while( overHangLen > 0 )
		{
			numOfCards ++;
			overHangLen -= 1.00 / (numOfCards + 1 );
		}
		sprintf( floatString, "%d card(s)\n", numOfCards );
		strncat( result, floatString, strlen( floatString ) );
	}
	cout << result ;
	return 0;
}

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