// CS290 Quiz (10-19-95) Solution #2 ... // using int digit array instead of char digit array. // Ron Paquette #include struct BigInt { // NOTE: DIGITS must be in REVERSE ORDER ! int digit[100]; BigInt operator++ () {// Add 1 and propagate carry as required... for(int i = 0; ++digit[i] == 10; i++ ) { digit[i] = 0; } } print () { int i = 99; while ( digit[i] == 0 ) { i--; } // skip leading zeros while ( i >= 0 ) { cout << digit[i]; i--; } } }; int main() { BigInt num = { 9, 9, 9, 6, 5, 4, 3, 2, 1 }; // digits in reverse order ! num.print(); cout << "++" << endl; num++; num.print(); cout << endl; }