请各位帮帮忙看一下那里错了
// Note:Your choice is C++ IDE#include "iostream.h"
#include<stdlib.h> //定义exit()函数
#include<math.h> //定义sqrt()、fabs()等数学函数
float x1,x2,disc,p,q;
float greater_zero(float a,float b)
{
x1=(-b+sqrt(disc))/(2*a);
x2=(-b+sqrt(disc))/(2*a);
}
float equal_zero(float a,float b)
{
x1=x2=(-b)/(2*a);
}
float smaller_zero(float a,float b)
{
p=(-b)/(2*a);
q=sqrt(disc)/(2*a);
}
void main()
{
float a,b,c;
cin>>a>>b>>c;
if(a=0)
{
cout<<"the single root is"<<-c/b<<endl;
exit(1);
}
disc=b*b-4*a*c;
if(disc>0)
{
greater_zero(a,b);
cout<<"x1="<<x1<<"x2="<<x2<<endl;
}
else
if(disc==0)
{
equal_zero(a,b);
cout<<"x1=x2="<<x1<<x2<<endl;
}
else
{
smaller_zero(a,b);
cout<<"x1="<<p<<"+"<<q<<"i"<<"x2="<<p<<"-"<<q<<"i";endl;
}
}
我想问一下,为什么会提示要返回一个值啊!我不是定义了全局变量吗?程序应该怎么改啊!