#include <iostream> #include <memory> using namespace std; int* BigNumberMulti(int arr1[], int length1, int arr2[], int length2) { int len = length1 + length2; int* ret = new int[len]; memset(ret, 0, sizeof(int)*len); for (int i = 0; i < length1; i++) { int x = i; for (int j = 0; j < length2; j++) { ret[x++] += arr1[i] * arr2[j]; } } for (int k = 0; k < len-1; k++) { if (ret[k] > 10) { ret[k + 1] += ret[k] / 10; ret[k] = ret[k] % 10; } } return ret; } int main() { int arr1[] = { 1,2,3,4,5,6,7,8,9 }; int arr2[] = { 9,8,7,6,5,4,3,2,1 }; int len1 = sizeof(arr1) / sizeof(arr1[0]); int len2 = sizeof(arr2) / sizeof(arr2[0]); int resultLen = len1 + len2; int* result = BigNumberMulti(arr1, len1 , arr2, len2); for (int i = resultLen -1; i >= 0; i--) { cout << result[i] << " " ; } cout << endl; delete[] result; return 0; }