// File: bigint.h // // Header file for arbitrary precision integers. #ifndef _bigint_h #define _bigint_h #include #define MINLEN 4 class BigInt { friend ostream& operator <<(ostream&, const BigInt&) ; public: // Constructors // BigInt(int n=0) ; // Default constructor BigInt(int, int) ; BigInt(const BigInt&) ; // Copy Constructor BigInt(const char *) ; // Type conv. string // Destructor // ~BigInt() ; // Overloaded Operators // BigInt& operator =(const BigInt&) ; // assignment BigInt operator +(const BigInt&) ; // arithmetic BigInt operator -(const BigInt&) ; BigInt operator *(const BigInt&) ; BigInt operator /(const BigInt&) ; BigInt operator %(const BigInt&) ; bool operator <(const BigInt&) const ; // comparisons bool operator <=(const BigInt&) const ; bool operator ==(const BigInt&) const ; bool operator >=(const BigInt&) const ; bool operator >(const BigInt&) const ; bool operator !=(const BigInt&) const ; // Type conversion // operator int *() { return (int *) ptr ; } // Debugging // void dump() const ; private: void newsize(int n) ; // Change buffer size to n, original deleted void trim() ; // Reduce buffer size if possible void force_trim() ; // Reduce buffer size to len unsigned char *ptr ; unsigned int len ; unsigned int bufsize ; } ; istream& operator >>(istream&, BigInt&) ; ostream& operator <<(ostream&, const BigInt&) ; #endif