Binary operator-(const Binary& other) { int maxSize = 0; if(strlen(this->binaryNum) > strlen(other.binaryNum)) maxSize = strlen(this->binaryNum); else maxSize = strlen(other.binaryNum); Binary result = new char[maxSize + 2]; assert(result!=NULL); if(this->getBinaryNum().fromBinary() > other.getBinaryNum().fromBinary()) { int tmp = this->getBinaryNum().fromBinary() - other.getBinaryNum().fromBinary(); strcpy(result.binaryNum, toBinary(tmp)); return result.binaryNum; } else return 0; }
bool operator<(const Binary& other) { return this->getBinaryNum().fromBinary() < other.getBinaryNum().fromBinary(); }
bool operator>(const Binary& other) { return (this->getBinaryNum().fromBinary()) > (other.getBinaryNum().fromBinary()); }