1.函数题在前面还是要写上函数接口定义的。
2.出现expected declaration or statement at end of input的错误,大多为括号匹配不对
3.要连乘的时候要先把初始值定位1.
4.如果n小于0,返回给原函数的时候NF等于0,执行else后面的语句,n=0,返回NF等于1,执行if后面的语句。
int Factorial( const int N )
{
int x=1;
if(N<0){
return 0;
}
else if(N==0){
return 1;
}
else{
for(int i=1;i<=N;i++){
x*=i;
}
return x;
}
}