如何用 C++ 编写这个数学公式?
How to write this mathematical formula in C++?
我有一个简单的公式,我想在 C++ 应用程序中使用它。
不确定如何用 C++ 重写。
你可以这样做,注意库、名称空间和弧度参数
z = a*b - d*c;
s = tan(c) + sin(d);
num = abs(z/s);
log(num)/log(5);
logn(5, abs((a*b - d*c) / (tan(c) + sin(d))))
其中 logn
是:
double logn(double base, double x) {
return log(x) / log(base);
}
并且 header cmath
包含在其他函数中。
我有一个简单的公式,我想在 C++ 应用程序中使用它。 不确定如何用 C++ 重写。
你可以这样做,注意库、名称空间和弧度参数
z = a*b - d*c;
s = tan(c) + sin(d);
num = abs(z/s);
log(num)/log(5);
logn(5, abs((a*b - d*c) / (tan(c) + sin(d))))
其中 logn
是:
double logn(double base, double x) {
return log(x) / log(base);
}
并且 header cmath
包含在其他函数中。