请问下面的代码哪儿错了,thanks
我刚学C++的,比较弱的问题#include <iostream.h>
int sum (int n);
void main ()
{
int n=0;
cout <<"input a number:" ;
cin >> n;
int sum (int n);
cout << "sum="<<n<<endl ;
}
int sum (int n)
{
if (n==1)
return 1 ;
else
return n+sum (n-1);
}
sum()函数似乎没被调用?