求函数的解(麻烦谁帮忙改一下)
#include<stdio.h>#include<math.h>
float DaYu(int a,int b,int c);
float XiaoYu(int a,int b,int c);
float DengYu(int a,int b,int c);
int main()
{
int m,n,l;
float x1,x2,t,result;
printf("qing shu ru m(m!=0),n,l:\n");
scanf("%d,%d,%d",&m,&n,&l);
t=n*n-4*m*n;
if(t>0)
{
result=DaYu(m,n,l);
printf("%.2f,%.2f",x1,x2);
}
else if(t<0)
{
result=XiaoYu(m,n,l);
printf("wujie");
}
else
{
result=DengYu(m,n,l);
printf("%.2f",x1);
return 0;
}
float DaYu(int a,int b,int c)
{
float x1,x2,t;
x1=(-b+sqrt(t))/(2*a);
x2=(-b-sqrt(t))/(2*a);
return x1,x2;
}
float XiaoYu(int a,int b,int c)
{
printf("wujie");
}
float DengYu(int a,int b,int c)
{
float x1;
x1=-b/2a;
}
错误:
test37.cpp
F:\c 源代码\test37\test37.cpp(12) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
F:\c 源代码\test37\test37.cpp(32) : error C2601: 'DaYu' : local function definitions are illegal
F:\c 源代码\test37\test37.cpp(40) : error C2601: 'XiaoYu' : local function definitions are illegal
F:\c 源代码\test37\test37.cpp(44) : error C2601: 'DengYu' : local function definitions are illegal
F:\c 源代码\test37\test37.cpp(46) : error C2059: syntax error : 'bad suffix on number'
F:\c 源代码\test37\test37.cpp(48) : fatal error C1004: unexpected end of file found