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 ERROR?本机运行没有问题啊#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator