Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- using namespace std;
- class LongLong
- {
- private:
- long* senior;
- unsigned long* junior;
- public:
- inline LongLong(__int64);
- inline LongLong(const LongLong&);
- inline ~LongLong();
- LongLong operator+(const LongLong&);
- LongLong& operator=(const LongLong& obj);
- inline __int64 showInt64();
- };
- LongLong::LongLong(__int64 number = 0)
- {
- senior = new long;
- *senior = number >> 32;
- junior = new unsigned long;
- *junior = number << 32 >> 32;
- }
- LongLong::LongLong(const LongLong& obj)
- {
- senior = new long; *senior = *obj.senior;
- junior = new unsigned long; *junior = *obj.junior;
- }
- LongLong::~LongLong()
- {
- delete senior;
- delete junior;
- }
- LongLong LongLong::operator+(const LongLong& obj)
- {
- LongLong a(*senior * pow(2, 32) + *junior + *obj.senior * pow(2, 32) + *obj.junior);
- return a;
- }
- LongLong& LongLong::operator=(const LongLong& obj)
- {
- *junior = *obj.junior;
- *senior = *obj.senior;
- return *this;
- };
- __int64 LongLong:: showInt64()
- {
- __int64 number = *senior * pow(2, 32) + *junior;
- return number;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement