新手编程求支招
#include<iostream.h>//一元二次方程#include<math.h>
void wujie();
void yijie(double a,double b,double c);
void liangjie(double a,double b,double c);
void main()
{double a,b,c,d;
cout<<"请依次输入a,b,c"<<endl;
cin>>a>>b>>c;
d=b*b-4*a*c;
if(d<0)
{void wujie();
}
if(d=0)
{void yijie(double a,double b,double c);
}
else
void liangjie(double a,double b,double c);
}
void wujie()
{
cout<<"方程无解"<<endl;
}
void yijie(double a,double b,double c)
{
double x1,d;
{d=b*b-4*a*c;
x1=(-1*b)/(2*a);
cout<<"该方程只有一解"<<"x="<<x1<<endl;
}
void liangjie(double a,double b,double c)
{double d,x1,x2;
d=b*b-4*a*c;
x1=(-1*b+sqrt(d))/(2*a);
x2=(-1*b-sqrt(d))/(2*a);
cout<<"该方程有两解"<<"x1="<<x1<<" "<<"x2="<<x2<<endl;
}
报错error C2601: 'liangjie' : local function definitions are illegal
报错fatal error C1004: unexpected end of file found