计算分数的浮点数值教程

bai123 暗区传说 2023-09-03 16:42:04 2023-09-04 20:46:44 12

题目说是双精度浮点数,a/b保留小数点后 9 位,所以是double和cout<<fixed<<setprecision(9)<<a/b;但是要命名+输入,输入用cin>>a>>b;数据类型是double,不是float,这样AC代码就有了:

   #include <bits/stdc++.h>
   using namespace std;
   int main(){
	double a, b;
	cin >> a >> b;
	cout<<fixed<<setprecision(9)<<a/b;
return 0;
    }

{{ vote && vote.total.up }}

共 2 条回复

bai123 暗区传说

你这是PS

tctm34

不如printf (bushi