deushiro

h

Nov 6th, 2020 (edited)
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <istream>
  3. #include <ostream>
  4. #include <string>
  5. #include <vector>
  6.  
  7. #ifndef BIGINTEGER_H
  8. #define BIGINTEGER_H
  9.  
  10. class BigInteger {
  11. public:
  12.     BigInteger(std::string s);
  13.     BigInteger();
  14.     std::string toString() const;
  15.     BigInteger(int x);
  16.  
  17.     BigInteger operator-();
  18.  
  19.     BigInteger& operator++();
  20.     BigInteger& operator--();
  21.     BigInteger operator++(int);
  22.     BigInteger operator--(int);
  23.  
  24.     friend std::ostream& operator<<(std::ostream&, const BigInteger&);
  25.     friend std::istream& operator>>(std::istream&, BigInteger&);
  26.  
  27.     friend bool operator==(const BigInteger &left, const BigInteger &right);
  28.     friend bool operator!=(const BigInteger &left, const BigInteger &right);
  29.     friend bool operator<(const BigInteger &left, const BigInteger &right);
  30.     friend bool operator>(const BigInteger &left, const BigInteger &right);
  31.     friend bool operator<=(const BigInteger &left, const BigInteger &right);
  32.     friend bool operator>=(const BigInteger &left, const BigInteger &right);
  33.  
  34.     operator bool() const;
  35.     operator std::string() const;
  36.  
  37.     friend BigInteger operator+(const BigInteger &l, const BigInteger &r);
  38.     friend BigInteger operator-(const BigInteger &l, const BigInteger &r);
  39.     friend BigInteger operator*(const BigInteger &left, const BigInteger &right);
  40.     friend BigInteger operator/(const BigInteger &dividend, const BigInteger &divisor);
  41.     friend BigInteger operator%(const BigInteger &left, const BigInteger &right);
  42.  
  43.     BigInteger& operator+=(const BigInteger &num);
  44.     BigInteger& operator-=(const BigInteger &num);
  45.     BigInteger& operator*=(const BigInteger &num);
  46.     BigInteger& operator/=(const BigInteger &num);
  47.     BigInteger& operator%=(const BigInteger &num);
  48.  
  49.     static void extend(std::vector<int> &a, int length);
  50.     static std::vector<int> NaiveMultiplication(std::vector<int> &left, std::vector<int> &right);
  51.     static std::vector<int> KaratsubaMultiplication(std::vector<int> &left, std::vector<int> &y);
  52.  
  53. private:
  54.     bool positive;
  55.     std::vector<int> number;
  56.  
  57.     BigInteger(std::vector<int> &a, bool sign);
  58.  
  59. };
  60.  
  61.  
  62. #endif
Advertisement
Add Comment
Please, Sign In to add comment