2_1.cpp

来自「c++书籍的源代码」· C++ 代码 · 共 18 行

CPP
18
字号
#include <iostream.h>
#include <iomanip.h>
 int main()
{
  cout<<setw(10)<<setiosflags(ios::left)<<"DATA1"
	  <<setw(10)<<setiosflags(ios::left)<<"DATA2"
	  <<setw(10)<<setiosflags(ios::left)<<"DATA3"<<endl;
  cout<<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<102.34
	  <<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<100.23
	  <<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<10.20<<endl;
  cout<<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<10.0
	  <<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<9.8
	  <<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<1.34<<endl;
  cout<<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<1000.56
	  <<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<1234.30
	  <<setw(10)<<setiosflags(ios::fixed)<<setprecision(2)<<145.39<<endl;
  return(0);
}

⌨️ 快捷键说明

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