首先加上头文件 <iomanip>
cout << setprecision(n) << fixed << variable << endl;
其中,setpercision() 括号中的数字即为小数点后限制的位数;fixed 表示不以科学计数法输出。
首先加上头文件 <iomanip>
cout << setprecision(n) << fixed << variable << endl;
其中,setpercision() 括号中的数字即为小数点后限制的位数;fixed 表示不以科学计数法输出。