error C2059: syntax error : 'constant'

来源:百度知道 编辑:UC知道 时间:2024/09/14 22:46:56
/**
A=1, B=50, C=3,The roots of the 1x^2+50x+3=0 are: x1=-49.9399 x2=-0.0600719.
A=5, B=4, C=6, There are non-real roots.(b*b-4*a*c<0)
A=0, B=0, C=0,The roots of the 0x^2+0x+0=0 are: x1=-1.#IND x2=-1.#IND.(It couse the infinite solutions when A,B and C are all 0.)
A=10, B=2, C=1,There are non-real roots.(b*b-4*a*c<0)
A=2, B=7, C=3,The roots of the 2x^2+7x+3=0 are: x1=-3 x2=-0.5.
*/

0

# include<iostream>
# include<cmath>
using namespace std;
float a,b,c,x1,x2;

int main()
{
cout << "This is a quadratic formula calculator" << endl;
cout << "Please enter a:\n";
cin >> a ;
cout << "Please enter b:\n";
cin >> b ;
cout << "Please enter c:\n";
cin >> c;
cout << "a is" << a << " b is"

头文件的上方有个0.把那个去掉

/**
A=1, B=50, C=3,The roots of the 1x^2+50x+3=0 are: x1=-49.9399 x2=-0.0600719.
A=5, B=4, C=6, There are non-real roots.(b*b-4*a*c<0)
A=0, B=0, C=0,The roots of the 0x^2+0x+0=0 are: x1=-1.#IND x2=-1.#IND.(It couse the infinite solutions when A,B and C are all 0.)
A=10, B=2, C=1,There are non-real roots.(b*b-4*a*c<0)
A=2, B=7, C=3,The roots of the 2x^2+7x+3=0 are: x1=-3 x2=-0.5.
*/

0 //就是这个,有这个玩意编译绝对通不过

# include<iostream>
# include<cmath>

我运行了,没有错误,最上面有个“0”,去掉就可以了

大概的