Class bigmultiply: bigcalculate
{
Public override string evaluate (string num1, string num2)
{
If (num1.equals ("0") | num2.equals ("0 "))
{
Return "0 ";
}
List liallnum = new list (); // stores the result of each multiplication of the multiplier.
List Lich = new list (); // stores the result of each digit of the multiplier multiplication.
// Assign a long number to num1 for later Computation
If (num1.length <num2.length)
{
Changenum (ref num1, ref num2 );
}
Int flag;
For (INT I = num2.length-1; I> = 0; I --)
{
// Initialize the data in the previous multiplication.
Lich. Clear ();
Flag = 0;
// Calculate the I-th digit multiplied by the J-th Digit
For (Int J = num1.length-1; j> = 0; j --)
{
Lich. Add (char) (num2 [I]-'0') * (num1 [J]-'0') + flag + '0 '));
Flag = (Lich [lich. Count-1]-'0')/10;
Lich [lich. Count-1] = (char) (Lich [lich. Count-1]-'0') %
10 + '0 ');
}
// If the carry value is not 0, add a bit
If (flag> 0)
{
Lich. Add (char) (flag + '0 '));
}
// Add a result set
Liallnum. Add (invertorder (new string (lich. toarray () + new
String ('0', liallnum. Count ));
}
Int COUNT = 0;
String res = "0 ";
// Call the add method to add the result of each multiplication, that is, the result
Bigadd addoper = new bigadd ();
While (count
{
Res = addoper. Loads (Res, liallnum [count]);
Count ++;
}
Return res;
}
}