I wrote a timesdigit method to multiple a bigint array by a num from 0-9. Now I need to use it to overload operator* to multiply two bigints together. But the problem is when I use the timesdigit it overwrites the array I only want the product of the times without changing the array itself.
ex
bigint a = {1111}
a.timesdigit(2);
a = 2222 I want it to equal 1111 still when the code is done.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//times a bigint by a digit 0-9
bigint bigint::timesdigit(int digit){
int carry =0;
int temp=0;
for(int i= ARRAYSIZE -1; i>0; --i){
temp=bigintArray[i];
bigintArray[i]=((bigintArray[i]*digit)+carry)%10;
carry = ((temp*digit)+carry)/10;
}
return *this;
}