/********************************************************************* C201 Computer Programming II Fall 2006 Dana Vrajitoru & Test file for the class representing large integer numbers. **********************************************************************/ #include "number.h" const Number Factorial(const Number &n); int main() { Number n, m; cout << "Enter two large numbers to test the arithmetic operations" << endl; cin >> n >> m; cout << "Addition: " << (n + m) << endl << "Subtraction: " << (n - m) << endl << "Multiplication: " << (n * m) << endl << "Division: " << (n / m) << endl << "Modulus: " << (n % m) << endl << endl; cout << "Enter a number to compute the factorial for" << endl; cin >> n; cout << "The factorial of f is " << Factorial(n) << endl; return 0; } // Computing the factorial of a number. // The factorial of 15 is 1307674368000. const Number Factorial(const Number &n) { Number f = 1, i; // The following tests the -- operator: // for (i = n; i >= 2; --i) { for (i = 2; i <= n; ++i) { // could use n >= i or i != n f *= i; // to test the other operators } return f; }