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

cin的状态

Posted by Alcyone at 2004-03-02 23:06:20 on Problem 1207
In Reply To:过了,但是不知道为什么。为什么把cin>>a>>b;拿到外面来下面再写一次就行?如下 Posted by:faononl at 2004-03-02 22:24:39
读到文件末时cin的状态仍为真
再读一次就读不到数据,cin的状态变为假,应在此时跳出循环
就是说应该这样写才对:

while (cin) {
cin>>a>>b;
if (!cin) break;//////
...
}

和你现在的写法是等同的。

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