¥¥¥C与C++函数表达问题¥¥¥
wfy 2003-07-31 02:29:36 从C升级到C++,学到函数时,以下CODE在C中通过在C++通不过,请教为什么?C与C++在函数调用的书写有什么不同?
#include <iostream.h>
void fac();
void main()
{
int n;
float s;
cin >> n;
s=fac(int n); /编译提示在此出错,为什么?C确可以通过/
cout << s;
}
float fac(int x)
{
int f;
if(x==0||x==1) f=1;
else f=fac(x-1)*x;
return f;
}