| ||||||||||
| 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 | |||||||||
即使没有空白也不会自动eofIn 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator