skipws

空间导致不按输入流读取。

ios_base& skipws( 
   ios_base& _Str 
);

参数

  • _Str
    引用类型到 ios_base对象,或者从 ios_base继承的类型。

返回值

为_Str 派生的对象的引用。

备注

默认情况下,skipws 实际上是。 noskipws 导致空间输入流读取。

操控程序有效调用 _Str.setf(ios_base::skipws),然后返回 _Str。

示例

#include <iostream>
#include <string>

int main( ) 
{
   using namespace std;
   char s1, s2, s3;
   cout << "Enter three characters: ";
   cin >> skipws >> s1 >> s2 >> s3;
   cout << "." << s1  << "." << endl;
   cout << "." << s2 << "." << endl;
   cout << "." << s3 << "." << endl;
}
  1 2 3

FakePre-85ce41e8ff314ecb9a59bb5aa9127476-b640ba2fd50c43118a9547ef33056b32

要求

页眉: <ios>

命名空间: std

请参见

参考

iostream 编程

iostreams 约定