菜鸟请教:
   各位大大,这是我自己仿照教材编写的程序,但是执行时,出现了诸多问提,我自己无法解决,请各位大大在时间允许的情况下给予帮助.谢谢!
程序:
#include <stdio.h>
#include <math.h>
float f(float x)
{
float y ;
y=(x*(x*x-5*x+16))-80 ;
return (y) ;
}
float qiux(float x1,float x2)
{
float x;
x=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1));
return (x);
}
float qiuzhi(float x1,float x2)
{
float x;
    x=qiux(float x1,float x2);
do
{
  if (x*f(x1)>=0)
  {
x=qiux(float qiux(float x1,float x2),float x2);
x1=qiux(float x1,float x2);
x2=x2;
  }
  else
  {
x=qiux(float x1,float qiux(float x1,float x2));
x1=x1;
x2=qiux(float x1,float x2);
  }
}
while (fabs(x)>=0.0001);
    return (x);
}
void main()
{
float x1,x2,f1,f2,x;
do
{
printf("input x1,x2;\n");
scanf ("%f,%f",&x1,&x2);
f1=f(x1);
f2=f(x2);
}
while(f1*f2>=0);
x=qiuzhi(x1,x2);
printf("A root of equation is%8.4f\n",x);
}错误提示:cpp(18) : error C2144: syntax error : missing ')' before type 'float'
 error C2660: 'qiux' : function does not take 0 parameters
 error C2059: syntax error : ')'
 error C2144: syntax error : missing ')' before type 'float'
 error C2660: 'qiux' : function does not take 0 parameters
 error C2059: syntax error : ')'
 error C2144: syntax error : missing ')' before type 'float'
 error C2660: 'qiux' : function does not take 0 parameters
 error C2059: syntax error : ')'
 error C2144: syntax error : missing ')' before type 'float'
 error C2660: 'qiux' : function does not take 0 parameters
 error C2059: syntax error : ')'
 error C2144: syntax error : missing ')' before type 'float'
 error C2660: 'qiux' : function does not take 0 parameters
 error C2059: syntax error : ')'
Error executing cl.exe.
再次感谢您的帮助!

解决方案 »

  1.   

    x2=qiux(float x1,float x2); 
    //类似这样的,都改成
    float x1, x2;
    x2 = (x1, x2);
      

  2.   

    呵呵,x2=qiux(float x1,float x2)
    第一次看到这么写的。
      

  3.   


    //汗,剧汗
    x2 = qiux(x1, x2);
      

  4.   

    谢谢各位大大为我解惑,但是能不能再告诉我为什么不能这样写了。再次感谢lfchen ,hucailai 的指教。
      

  5.   

    你调用函数时,传给函数的是实参,而实参已经在之前定义了的。
    如果你真的想那样用的话,可以写成这样
    x2=qiux((float) x1,(float) x2)