判断流对象是否处于正常状态

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     float grade;
 7     cout<<"enter grade:";
 8     while(cin>>grade)
 9     {
10         if(grade>=85)
11         cout<<grade<<"GOOD!"<<endl;
12         if(grade<60)
13         cout<<grade<<"fail!"<<endl;
14         cout<<"enter grade:";
15     }
16     cout<<"The end."<<endl;
17     return 0;
18 }

 

posted @ 2018-08-02 10:17  borter  阅读(159)  评论(0编辑  收藏  举报