求助 不懂怎么修改这个程序
#include "iostream"#include "math.h"
using namespace std;
int main()
{
float q;
float a=1,b=2,c=1;
float x1,x2;
q=b*b-4*a*c;
if(q>0)
{
x1=(-b+sqrt(q))/(2*a);
x2=(-b-sqrt(q))/(2*a);
cout<<"x1="<<x1=(-b+sqrt(q))/(2*a)<<" \n "<<"x2="<<x2=(-b-sqrt(q))/(2*a)<<endl;
}
else if(q==0)
{
x1=(-b+sqrt(q))/(2*a);
x2=(-b-sqrt(q))/(2*a);
x1==x2;
cout<<"x1=x2="<<x1=(-b+sqrt(q))/(2*a)<<endl;
}
else(q<0)
{
cout<<"无解"<<endl;
}
return 0;
}
错误提示F:\c++\VC6\MyProjects\dwf\ff.cpp(15) : error C2296: '<<' : illegal, left operand has type 'double'
[ 本帖最后由 l2480035288 于 2013-3-29 11:30 编辑 ]