yhh2530080997 发表于 2015-8-8 22:39:24

初学者,求助!!!,麻烦各位帮我分析一下这代码的运行结果,实在行不通,谢谢各位!

#include <iostream>

using namespace std;

int main()
{
      int width = 4;
      char str;

      cout << "请输入一段文本: \n";
      cin.width(5);

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

      return 0;
}

~风介~ 发表于 2015-8-10 23:11:34

没什么值得分析的呀!
页: [1]
查看完整版本: 初学者,求助!!!,麻烦各位帮我分析一下这代码的运行结果,实在行不通,谢谢各位!