Mint Mint::operator+=(const Mint &rhs) {
int sum;
int carry = 0;
unsigned int i;
if (num.size() < rhs.num.size())
{
while(num.size() < rhs.num.size())
{
num.push_back(0);
}
}
unsigned int len = num.size() ;
for (i=0;i<len;i++)>
{
sum = num[i] + rhs.num[i] + carry;
carry = sum / 10;
sum = sum % 10;
if (i < len)
{
num[i] = sum;
}
else
{
num.push_back(sum);
}
}
if(carry != 0 )
{
num.push_back(carry);
}
return *this;
}
would something like this work.?