| ||||||||||
| 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 | |||||||||
cin的状态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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator