初涉大数运算(上)

#include < string>
#include <vector>

using namespace std;
using namespace System;

namespace Calculate
{
   class LargeDecimal
  {
   public:
    LargeDecimal();
    LargeDecimal(int iNumber);
    LargeDecimal(long lNumber);
    LargeDecimal(float fNumber);
    LargeDecimal(double dNumber);
    LargeDecimal( String ^ strNumber);

    LargeDecimal operator +(LargeDecimal & ldSecond) const;
    LargeDecimal operator +(int iNumber) const;
    LargeDecimal operator +(long lNumber) const;
    LargeDecimal operator +(float fNumber) const;
    LargeDecimal operator +(double dNumber) const;
    LargeDecimal operator +( String ^ strNumber) const;

    LargeDecimal operator -(LargeDecimal & ldSecond) const;
    LargeDecimal operator -(int iNumber) const;
    LargeDecimal operator -(long lNumber) const;
    LargeDecimal operator -(float fNumber) const;
    LargeDecimal operator -(double dNumber) const;
    LargeDecimal operator -( String ^ strNumber) const;

    LargeDecimal operator *(LargeDecimal & ldSecond) const;
    LargeDecimal operator *(int iNumber) const;
    LargeDecimal operator *(long lNumber) const;
    LargeDecimal operator *(float fNumber) const;
    LargeDecimal operator *(double dNumber) const;
    LargeDecimal operator *( String ^ strNumber) const;

    LargeDecimal operator /(LargeDecimal & ldSecond) const;
    LargeDecimal operator /(int iNumber) const;
    LargeDecimal operator /(long lNumber) const;
    LargeDecimal operator /(float fNumber) const;
    LargeDecimal operator /(double dNumber) const;
    LargeDecimal operator /( String ^ strNumber) const;

    LargeDecimal operator %(LargeDecimal & ldSecond) const;
    LargeDecimal operator %(int iNumber) const;
    LargeDecimal operator %(long lNumber) const;
    LargeDecimal operator %(float fNumber) const;
    LargeDecimal operator %(double dNumber) const;
    LargeDecimal operator %( String ^ strNumber) const;

    LargeDecimal operator +=(LargeDecimal & ldSecond);
    LargeDecimal operator +=(int iNumber);
    LargeDecimal operator +=(long lNumber);
    LargeDecimal operator +=(float fNumber);
    LargeDecimal operator +=(double dNumber);
    LargeDecimal operator +=( String ^ strNumber);

    LargeDecimal operator -=(LargeDecimal & ldSecond);
    LargeDecimal operator -=(int iNumber);
    LargeDecimal operator -=(long lNumber);
    LargeDecimal operator -=(float fNumber);
    LargeDecimal operator -=(double dNumber);
    LargeDecimal operator -=( String ^ strNumber);

    LargeDecimal operator *=(LargeDecimal & ldSecond);
    LargeDecimal operator *=(int iNumber);
    LargeDecimal operator *=(long lNumber);
    LargeDecimal operator *=(float fNumber);
    LargeDecimal operator *=(double dNumber);
    LargeDecimal operator *=( String ^ strNumber);

    LargeDecimal operator /=(LargeDecimal & ldSecond);
    LargeDecimal operator /=(int iNumber);
    LargeDecimal operator /=(long lNumber);
    LargeDecimal operator /=(float fNumber);
    LargeDecimal operator /=(double dNumber);
    LargeDecimal operator /=( String ^ strNumber);

    LargeDecimal operator %=(LargeDecimal & ldSecond);
    LargeDecimal operator %=(int iNumber);
    LargeDecimal operator %=(long lNumber);
    LargeDecimal operator %=(float fNumber);
    LargeDecimal operator %=(double dNumber);
    LargeDecimal operator %=( String ^ strNumber);

    bool operator >(LargeDecimal & ldSecond) const;
    bool operator >(int iNumber) const;
    bool operator >(long lNumber) const;
    bool operator >(float fNumber) const;
    bool operator >(double dNumber) const;
    bool operator >( String ^ strNumber) const;

    bool operator <(LargeDecimal & ldSecond) const;
    bool operator <(int iNumber) const;
    bool operator <(long lNumber) const;
    bool operator <(float fNumber) const;
    bool operator <(double dNumber) const;
    bool operator <( String ^ strNumber) const;

    bool operator >=(LargeDecimal & ldSecond) const;
    bool operator >=(int iNumber) const;
    bool operator >=(long lNumber) const;
    bool operator >=(float fNumber) const;
    bool operator >=(double dNumber) const;
    bool operator >=( String ^ strNumber) const;

    bool operator <=(LargeDecimal & ldSecond) const;
    bool operator <=(int iNumber) const;
    bool operator <=(long lNumber) const;
    bool operator <=(float fNumber) const;
    bool operator <=(double dNumber) const;
    bool operator <=( String ^ strNumber) const;

    bool operator ==(LargeDecimal & ldSecond) const;
    bool operator ==(int iNumber) const;
    bool operator ==(long lNumber) const;
    bool operator ==(float fNumber) const;
    bool operator ==(double dNumber) const;
    bool operator ==( String ^ strNumber) const;

    bool operator !=(LargeDecimal & ldSecond) const;
    bool operator !=(int iNumber) const;
    bool operator !=(long lNumber) const;
    bool operator !=(float fNumber) const;
    bool operator !=(double dNumber) const;
    bool operator !=( String ^ strNumber) const;

    LargeDecimal operator ++(int);
    LargeDecimal operator ++();
    LargeDecimal operator --(int);
    LargeDecimal operator --();

    LargeDecimal operator -() const;

    LargeDecimal operator ~() const;

    LargeDecimal Abs();
    LargeDecimal Random();

     String ^ ToString();
    LargeDecimal ToInteger();
    LargeDecimal ToDecimal();

    std::vector<long>::size_type Size();
   private:
    bool bIsNegative;
    long lPoint;
    std::vector<long> Integer;
    std::vector<long> Decimal;
  };
}

你可能感兴趣的:(职场,休闲,大数)