How do I multiply two arrays? Assuming that the numbers in the arrays are all single digit integers, which makes the array a big integer. Now I want to multiply these two big integers formed from arrays and also at the same time display steps.
Please don't use multidimensional arrays but if it is the only way, then please explain a bit. I really want to understand this stuff.
The following is the example I wrote till now.
#include <iostream>
using namespace std;
int main ()
{
int indexOne, indexTwo = 5, tempValOne, tempValTwo, tempValThree, carry, result, outPut;
int multiplicand[1] = {4};
int multiplier[1] = {4};
for(indexOne = 0; indexOne >= 0; indexOne --)
{
tempValOne = multiplier[indexOne];
while(tempValOne >= 0)
{
tempValThree += tempValTwo;
tempValOne --;
}
}
cout << tempValThree << endl;
// change color to green as this will be don now
/*for(indexOne = 5; indexOne >= 0; indexOne--)
{
multiplicand[indexOne] = tempValOne + carry;
multiplier[indexTwo] = tempValTwo;
result = tempValOne * tempValTwo;
outPut = result % 10;
carry = result / 10;
//cout << outPut << endl;
cout << result << endl;
}
*/
system ("PAUSE");
return 0;
}