scanf函数的返回值说明。
Returns the number of fields successfully converted and assigned; the return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned.
If format is a NULL pointer, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, these functions return EOF and set errno to EINVAL.
EOF就是-1,是在stdio.h里定义的。
按照上面的说明,scanf函数只有在第一个参数为NULL(空指针)的情况下,才可能返回EOF,否则,返回成功格式化并赋值的参数个数(>=0)。
所以,楼主你的这个循环,将是一个死循环。
另外,站长团上有产品团购,便宜有保证
scanf()是有返回值的,详细的可以参见百度百科
http://baike.baidu.com/view/1390039.html?wtp=tt#1
如果不修改代码的话,按Ctrl+z就可以结束了
还有第二个的话fin.eof(),这个是C++ 的吧,不是很清楚