#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
double t;
int n;
cin >> t >> n;
cout << setprecision(3)<<fixed<<t / n << endl << 2 * n << endl;
system("pause");
return 0;
}
使用setprecision需要用到头文件 iomanip
setprecision用来精确有效位数
当setprecision与fixed配合使用可以用来固定小数点后的位数。