c++ primerplus的练习题,求解惑
#include<iostream>using namespace std;
long long chengjie(long long);
int main()
{
long long a;
while (cin >> a)
{
long long b;
if (a == 0 || a == 1)
b = 1;
else
{
b = chengjie(a);
}
cout << b;
}
}
long long chengjie(long long a)
{
if (a > 1)
{
cout << a <<"第一部"<<endl;
a = a*chengjie(a-1);//把这儿换成a = a*chengjie(--a);运行结果不同呢
cout << a <<"第二部"<< endl;
}
return a;
}