自定义函数解法
2026-08-08 20:06:52
发布于:江苏
13阅读
0回复
0点赞
既然放在自定义函数里面,那就自定义函数做呗
#include<bits/stdc++.h>
using namespace std;
double f(int s, int t1, int t2) {
const double pi = 3.14;
double x = (double)s / t1;
double y = x * t2;
double r = cbrt(3.0 * y / (4.0 * pi));
return r;
}
int main(){
int s, t1, t2;
if (cin >> s >> t1 >> t2) {
double radius = f(s, t1, t2);
cout << fixed << setprecision(2) << radius << endl;
}
return 0;
}
这里空空如也







有帮助,赞一个