このプログラムで数式を使用して値の範囲を評価するのに問題があります。
範囲 = (-3.0,4.0) 数式 = (9(x^3)-27(x^2)-4x+12) / (sqrt(3(x^2)+1) + abs(5-(x^ 4)))
プログラムは、y as -1.IND
なぜすべての y が出てくるのかを明らかにするための助けをいただければ幸い-1.IND
です。
ありがとう、デイブ
#include <iostream>
#include <cmath>
using namespace std;
int main() {
cout << "This program outputs formula results\n";
long double x = -3.0;
long double y = 1.0;
long double a = (9*(pow(x,3))-27*(pow(x,2))-4*x+12);
long double b = (sqrt(3*(pow(x,2))+1) + abs(5-(pow(x,4))));
y = a/b;
for(;x <4.5; x=x+.5){
cout << "X = " << x << ", " << "Y = " << y;
if(y==0)
cout << "Y IS ZERO" << endl;
else if(y<0)
cout << "Y IS NEGATIVE" << endl;
else if(y>0)
cout << "Y IS POSITIVE\n" << endl;
}
return 0;
}