## Fool 11

This is a thread containing a problem similar to my previous thread"a crazy problem(at least to me)".

Yet i start it in a new thread is because the approach will surely be much more complicated and perhaps should be treated as another crazy problem.

This program should read in 2 input extremely large postive integers. It will then output their product.
However , as C++ got limit in int, i need to use string variables to represent the values..then use some loops to get pairs of digits first multiplied then add up together.

please stick to my suggestions and avoid showing me some higher levels techs or new libraries. It should be a very challenging one.

ALSO, DON'T PUT DOWN EXACT CODE EVEN IF YOU HAVE DONE THIS BEFORE. JUST GIVING HINTS, GUIDES OR IDEAS WILL ALREADY MAKE ME FEEL VERY GRATEFUL .

thank you.^.^

## Salem 5,138

Well did you take my hint from last time, about working it out on paper?

## Fool 11

Yes, thank you Salem. But this time is really a lot more complicated. I think i should use a loop inside a loop.....

## iamthwee 1,547

A loop, inside a loop! Now you're really going to have to fire those neurons and work the brains. If you can't do that perhaps you ought to direct your attention of study to something less taxing.

## Fool 11

That's really hard training i know. But you will gain much after this. Just like life.

## iamthwee 1,547

Are you talking to yourself in the third person again?

## Fool 11

................i think it is juz being polite to reply to those who had read my problem and MAY have tried to help....sorry

## Salem 5,138

I guess a loop inside a loop is a start.

## Fool 11

how can i fix one digit in le2, multiply it to the whole length of le1...then move the digit in le2 one to the left, multiply ag and add a '0' at the end....sum up...start the third move digit.....?

i have already solved multiplying one very large integer to a single digit...and can use my large-sum program as a pre-function for adding up strings of numbers

## Salem 5,138

Well in the loop which counts from right to left along the multiplier, add another loop which counts forwards to pad the result with the appropriate number of training zeros.

Post code.

## Fool 11

``````#include <iostream>
#include <string>
using namespace std;

int main() {
string no1, no2, result;
string tempsum;
string product, reversedproduct;
cin >> no1 >> no2;

for (int i = 0; i < no2.length(); i++) {

for (int j = no1.length()-1; j >= 0; j--) {
int digit = static_cast <int>(no2[i]-48)*static_cast <int>(no1[j]-48);

// Handling overflow and store it to tempsum
// reverse tempsum
}

// Add '0' accordingly
for (int k = no2.length()-1; k > 0; k--) {
tempsum += '0';
}

//Finish adding one column
}
//Handle how to add each column by my previous program
}
``````

Is this the correct flow?..sorry i cant post exact codes to avoid handing in work thought to be copied from the web (which in fact is from me)

## Fool 11

Thanks to everyone who replied. I have finished this problem and is feeling very happy.^.^

commented: Good job! +11