istream::operator >>
istream& operator >>( char* psz );
istream& operator >>( unsigned char* pusz );
istream& operator >>( signed char* pssz );
istream& operator >>( char& rch );
istream& operator >>( unsigned char& ruch );
istream& operator >>( signed char& rsch );
istream& operator >>( short& s );
istream& operator >>( unsigned short& us );
istream& operator >>( int& n );
istream& operator >>( unsigned int& un );
istream& operator >>( long& l );
istream& operator >>( unsigned long& ul );
istream& operator >>( float& f );
istream& operator >>( double& d );
istream& operator >>( long double& ld ); (16-bit only)
istream& operator >>( streambuf* psb );
istream& operator >>( istream& (*fcn)(istream&) );
istream& operator >>( ios& (*fcn)(ios&) );
這些是本來>>支持的類型。
對于cin來說,如cin>>(int)a,而輸入一字符串,則會使cin陷入錯誤狀態,故在輸入之前應該先檢查if(isdigit(a))。
posted on 2006-06-27 21:34
栗子 閱讀(481)
評論(1) 編輯 收藏 引用 所屬分類:
學習有感