#include "num.h" #include using namespace std; Num::Num(int value, int modulo) { (modulo == 0) ? this->value = value : this->value = value % modulo; this->modulo = modulo; } Num &Num::operator=(const Num &other) = default; Num Num::operator+(int number) { this->value += number; this->value %= this->modulo; return *this; } Num Num::operator-(int number) { this->value -= number; this->value %= this->modulo; return *this; } Num Num::operator*(int number) { this->value *= number; this->value %= this->modulo; return *this; } Num &Num::operator+=(int number) { this->value += number; this->value %= this->modulo; return *this; } Num Num::operator+(const Num &other) { this->value += other.value; this->value %= this->modulo; return *this; } Num Num::operator-(const Num &other) { this->value -= other.value; this->value %= this->modulo; return *this; } Num Num::operator*(const Num &other) { this->value *= other.value; this->value %= this->modulo; return *this; } Num &Num::operator-=(int number) { this->value -= number; this->value %= this->modulo; return *this; } Num &Num::operator*=(int number) { this->value *= number; this->value %= this->modulo; return *this; } Num &Num::operator+=(const Num &other) { this->value += other.value; this->modulo = modulo; this->value %= this->modulo; return *this; } Num &Num::operator-=(const Num &other) { this->value += other.value; this->modulo = modulo; this->value %= this->modulo; return *this; } Num &Num::operator*=(const Num &other) { this->value += other.value; this->modulo = modulo; this->value %= this->modulo; return *this; }