#include <iostream> using namespace std; const int ArSize = 16; int main() { double factorial[ArSize]; //初始化0,1的阶乘 factorial[1] = factorial[0] = 1; //初始化迭代循环 int i; //计算迭代结果 for (i = 2;i < ArSize;i++) { factorial[i] = factorial[i-1]*i; } //输出迭代结果 for (i = 0;i< ArSize;i++) { cout<<i<<"! = "<<factorial[i]<<endl; } system("pause"); return 0; }
转载于:https://www.cnblogs.com/s380774061/archive/2011/08/26/2483340.html