求所有因数
#include <iostream>
using namespace std;
void reduce(int n)
{
//int nFind = 0;
for (int m = 2; m <= n / 2; m++)
{
if (0 == n % m)
{
cout<< m << endl;
n /= m;
reduce(n);
// nFind = 1;
// break;
}
}
/* if (0 == nFind)
{
cout<< n << endl;
}*/
}
int main()
{
int n;
cout << "please write a number:" << endl;
cin >> n;
reduce(n);
return 0;
}
注释之前是正确的,但注释后却有错.请问怎么理解