
写出下列程序的运行结果。 #include <iostream> using namespace std; 5
写出下列程序的运行结果。#include<iostream>usingnamespacestd;intfun(intx){if(x<=0){return0;}elsere...
写出下列程序的运行结果。
#include<iostream>
using namespacestd;
int fun(int x)
{
if(x <= 0)
{
return 0;
}
else
return x * x +fun(x - 1);
}
int main( )
{
int x = fun(3);
cout << x<< endl;
return 0;
} 展开
#include<iostream>
using namespacestd;
int fun(int x)
{
if(x <= 0)
{
return 0;
}
else
return x * x +fun(x - 1);
}
int main( )
{
int x = fun(3);
cout << x<< endl;
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询