求cin >>ws; 作用
为避免"高人"直接贴msdn, 我先给你贴出来, 如果你真是高手, 请解释...
Skips white space in the stream. // 如何使用呢?
template class<Elem, Tr>
basic_istream<Elem, Tr>& ws(
basic_istream<Elem, Tr>& _Istr
);
Parameters
_Istr
A stream.
Return Value
The stream.
Remarks
The manipulator extracts and discards any elements ch for which use_facet< ctype<Elem> >(getloc). is(ctype<Elem>::space, ch) is true.
The function calls setstate(eofbit) if it encounters end of file while extracting elements. It returns _Istr.
Example
See operator>> for an example of using ws.
Requirements
Header: <istream>
Namespace: std
See Also
Concepts
<istream> Members