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

即使没有空白也不会自动eof

Posted by frkstyc at 2006-06-05 12:09:26 on Problem 1207
In Reply To:明白为什么了(里面有内容) Posted by:xbz at 2006-06-05 03:49:54
> while (!cin.eof()) {
> 	cin >> a >> b;
> 
> 我自己写的测试数据的最后一行是这样的:
> 900 1000
> 1000后面直接是EOF,
> 这样,读完1000后,
> 流的状态就变成EOF了,
> 于是可以用cin.eof()来判断。
> 
> 而如果1000后面还有空白的话,
> 读完1000后状态不会变成EOF,
> cin.eof()就没用了,
> 会再读一次,就出错了。
> 估计系统的测试数据的最后有空白。
> 
> 呵呵,多谢了。:)

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