Hi every one well i have this problem: Im creating a method for multiplying two different lists sorted in arrays example: MyList a [9,9,9,9] * MyList B[1,1,9]
the problem is that i was told not to convert to a large int and then multiply like this 9999*9 +9999*1+9999*9
Since the objective is to use array Lists i already figure out that i have to take the firs number of one of the array's multiply it by each number on the second list (array) and stored each individual result in a new array and then use the method AddList (that i already create).
there's no problem on doing the "for" or anything else my only question is :
How can i create as many arrays as number on the list b and rename them on the process this is my idea of the algorithm:
void MyLIST::mult (MyList a, MyList B)
{
int count;
for ( int i = b.size ,i>0;i-- ) //in our case b.size=3 so it should create 3 new list
{
myList i = new myList(); // this is the problem!!!!!! can't rename like this.
for(int j =b.size-1; j>0; j-- )
{
for(int y=a.size-1; y>0; y--)
{
i[count ]= a[y]*b[j]; //multiplication not every case contemplated here
count++;//counter to fill the new array
}
}
}
}
this algorithm wont work is just an example;
so again does any one have an idea of how can create the lists and renamed them with out knowing a fix number for the array size????
thanks in advance.
and just to be clear this isn't a homework just personal hobbie and asking here was my last resource thank you.