1.一个C++文件:
#include <iostream>
#include <array>
#include <vector>
using namespace std;
int Factorial_calculate(int i) {
return i * Factorial_calculate(i - 1);
}
int main()
{
vector <int> num(1);
array <long double, 5> prices = { 4.99 , 10.99 , 6.87 , 7.99 ,8.49 };
cout << "Please enter a number:" << endl;
cin >> num[0];
cout << Factorial_calculate(num[0]);
return 0;
}
2.运行测试后出现这种情况:(0x002341E9 处有未经处理的异常(在 第二题.exe 中): 0xC00000FD: Stack overflow (参数: 0x00000001, 0x00662FCC)。)
递归没有结束条件导致堆栈溢出了