Solved
Implementation of a new data type (64-bit integer)
Posted on 1998-11-15
How to design and implement a 64-bit integers, which is a new data type for C++? The new data type should support the operator +, -, *, /, and % by C++ operator overloading technique.
Here is the class design for the data type INT64:
class INT64{
private:
unsigned long data[2];
public:
INT64(); //constructor
friend INT64 operator+(const INT64 &val1, const INT64 &val2);
friend INT64 operator-(const INT64 &val1, const INT64 &val2);
friend INT64 operator*(const INT64 &val1, const INT64 &val2);
friend INT64 operator/(const INT64 &val1, const INT64 &val2);
friend INT64 operator%(const INT64 &val1, const INT64 &val2);
friend int operator==(const INT64 &val1, const INT64 &val2);
ostream & operator<<(ostream & outs, const INT64 & val);
istream & operator>>(istream & ins, INT64 & val);
};
Can anyone help me to implement the member functions inside the class?