#include #include "bigint.h" using namespace std; // illustrates loop and integer overflow // displays a table of factorials between 0 and an input number BigInt Factorial(long num); int main() { int highValue; // variable to store the upper bounf for the factorial table int current = 0; // compute factorial of this value cout << "Enter the number up to which factorials will be calculated: "; cin >> highValue; while (current <= highValue) { cout << current << "! = " << Factorial(current) << endl; current += 1; } /* for (int current=0; current <= highValue; current += 1) { cout << current << "! = " << Factorial(current) << endl; } */ return 0; } BigInt Factorial(long num) // precondition: num >= 0 // postcondition returns num! { BigInt product = 1; long count = 0; // can be 1 while (count < num) { count += 1; product *= count; } return product; }