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