65,211
社区成员
发帖
与我相关
我的任务
分享#include<iostream>
using namespace std;
#define DEBUG
int factorial(int num)
{
if(num == 0)
return 1;
else
{
# if defined(DEBUG)
static i;
cout << "call times:" << ++i << ",num=" << num <<endl;
# endif
return factorial(num -1) * num;
}
}
int main()
{
int number;
cout << "enter a integer:";
cin >> number;
cout << "the factorial number:"
<< factorial(number)
<< endl;
return 0;
}#define DEBUG
int factorial(int num)
{
if(num == 0)
return 1;
else
{
# if defined(DEBUG)
static i;
cout << "call times:" << ++i << ",num=" << num <<endl;
# endif
# if defined(DEBUG)
static i;
cout << "call times:" << ++i << ",num=" << num <<endl;
# endif