fig11_18.cpp

来自「经典vc教程的例子程序」· C++ 代码 · 共 23 行

CPP
23
字号
// fig11_18.cpp 
// Demonstrating the width member function
#include <iostream.h>

int main()
{
   int w = 4;
   char string[ 10 ];

   cout << "Enter a sentence:\n";
   cin.width( 5 );

   while ( cin >> string ) {
      cout.width( w++ );
      cout << string << endl;
      cin.width( 5 );
   }

   return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?