⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p11_5.cpp

📁 相当丰富的C++源码
💻 CPP
字号:
/***************************************************
* 程序名:p11_5.cpp                                *
* 功能: 格式操纵符与成员函数对比                  *
*                    By Antony                     *
*                     11-24-2005                   *
****************************************************/
# include <iostream>
# include <iomanip>
using namespace std;
void main() {
	double PI=3.1415926535;
	int precision;
	cout<<fixed;
	cout<<PI<<endl;
	cout.width(8);
	cout.fill('0');
	for(precision=0;precision<=9;precision++) {
		cout.precision(precision);
		cout<<PI<<endl;
	}
	cout<<PI<<endl;
    cout<<setw(8)<<setfill('0');
	for(precision=0;precision<=9;precision++) {
		cout<<setprecision(precision);
		cout<<PI<<endl;
	}
	cout<<PI<<endl; 
 }

⌨️ 快捷键说明

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