left shift problem

hey folks, im trying to shift the partial product left in the array but it gives me / as result!

is my code buggy?!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Bigint operator *(const Bigint& n1, const Bigint& n2) {
    Bigint product;
    int carry = 0;

    for (int i = DIGITS - 1; i >= 0; i--) {
        for (int j = DIGITS - 1; j >= 0; j--) {
            product.digits_[j] = n1.digits_[i] * n2.digits_[j];
            product.digits_[j] += carry;

            // Algorithm for calculating result of addition
            if (product.digits_[j] > 9) {
                carry = product.digits_[j] / 10;
                product.digits_[j] %= 10;

            } else {
                carry = 0;
            }
        }
        product = product << i;
    }
    return product;
}

int operator << (const Bigint& n1, int n) {
    
    Bigint num1 = n1;
    
    int i;
    for (i = DIGITS - 1; i >= n; i--) {
        num1.digits_[i] = num1.digits_[i + n];
    }
    while (i >= 0) {
        num1.digits_[i--] = 0;
    }
}

Topic archived. No new replies allowed.