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

📄 11_9.cpp

📁 C++语言程序设计案例教程,郑莉编的书
💻 CPP
字号:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{  double root = sqrt( 3.0 ); 							//计算3的平方根
   cout << "Precision set by precision:\n" << fixed; 		//使用fixed精度
   for (int  i = 0; i <= 4; i++ ) 
   {		cout.precision( i );	cout << root << endl; } 	//使用precision显示平方根
   cout << "Precision set by setprecision:" << endl;
   for ( i = 0; i <= 4; i++ )
      	cout << setprecision( 2*i ) << root << endl;  	//使用setprecision重新设置精度
   return 0;
}

⌨️ 快捷键说明

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