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.^.^

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

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

Member Avatar for iamthwee

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.

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

Member Avatar for iamthwee

Are you talking to yourself in the third person again?

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

I guess a loop inside a loop is a start.

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

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.

#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)

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

commented: Good job! +11
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.