65,186
社区成员




int main()
{
cin.setstate(istream::badbit);
cout << (cin.rdstate() & istream::failbit) << endl;
if (cin.fail())
cout << "fail" << endl;
else
cout << "not fail" << endl;
}
basic_ios::fail
Indicates the status of rdstate & failbit.
bool fail( ) const;
Return Value
1 or true if rdstate & failbit is nonzero, otherwise 0 or false.