/*void stream::clear( iostate flags = ios::goodbit );The function clear() does two things:
it clears all io_stream_state_flags associated with the current stream,
and sets the flags denoted by flags*/intval;while(cin>>val,!cin.eof()){if(cin.bad()){throwruntime_error("IO stream corruped!");}if(cin.fail()){cerr<<"bad data,try agin!";cin,clear(istream::goodbit);cin.ignore(numeric_limits<streamsize>::max(),'\n');continue;}}