BigInt& BigInt::operator*(const BigInt& x) const { BigInt* result = new BigInt(); BigInt a = Abs(); BigInt b = x.Abs(); for(long long i = 0; i < MAXBIT - 1; i++) { if(x.GetElement(i) == 0) continue; for(long long j = 0; j < MAXBIT - 1; j++) { if(a.GetElement(j) == 0) continue; result->SetElenemt(i + j, result->GetElement(i + j) + a.GetElement(j) * x.GetElement(i)); } result->Refine(); } if(isNegtive() == x.isNegtive()) result->SetElenemt(MAXBIT - 1, 0); else result->SetElenemt(MAXBIT - 1, JINZHI - 1); return *result; }
BigInt& BigInt::operator+(const BigInt& x) const { BigInt* result = new BigInt(); for(long long i = 0; i < MAXBIT; i++) result->SetElenemt(i, GetElement(i) + x.GetElement(i)); result->Refine(); return *result; }