// arrayforloop_02.cpp -- more looping with for
#include <iostream>
using namespace std;
// example of external declaration - can be used in any fucntion
const int ArSize = 16;


int main()
{
    double factorials[ArSize];
    // this assigns the first two values in our array to 1.0
    factorials[1] = factorials[0] = 1.0;

    // filling up the rest of the array using the fancy factorial
    // equation f(n) = f(n) * f(n-1).
    for (int i = 2; i < ArSize; i++)
        factorials[i] = i * factorials[i-1];

    // printing them out
    for (int i = 0; i < ArSize; i++)
        cout << i << "! = " << factorials[i] << endl;

}
