【发布时间】:2019-03-30 11:58:57
【问题描述】:
我想在 C++ 中只使用 a、b 和 c 作为变量,主要使用括号,但我没有得到正确的答案。
root1 = ((-1*b) + (std::sqrt((b*b) - (4*a*c)))) / 2*a;
root2 = ((-1*b) - (std::sqrt((b*b) - (4*a*c)))) / 2*a;
【问题讨论】:
-
考虑将minimal reproducible example 放在一起,显示您正在使用的值并解释您的结果和正确的结果。
-
-1*b的另一种说法是-b。
标签: c++ formula quadratic-programming