Code: Select all
SetBatchLines -1
input_number := 1234
power := 1234
constant_to_be_multiplied := input_number
array1 := strsplit(input_number)
TO_Carry := 0
carry_carry := 0
loop % array1.maxindex()+1
end_result .= "0"
array_Total := strsplit(end_result)
;===========================================
loop, % power - 1
{
;~ MsgBox % end_result
if ( end_result = 0 )
end_result := input_number
end_result := "0" . end_Result
array := strsplit(end_Result)
;~ MsgBox % array.maxindex()
;===multiplying========
;~ MsgBox % End_result . "*" . input_number ;================================================= IMPORTANT===========================================
loop, % array1.maxindex()
{
zeroes := A_index
digit_to_multiply_with_number := array1[array1.maxindex()- A_index + 1]
loop, % array.maxindex()
{
result := digit_to_multiply_with_number * array[array.maxindex() - A_index + 1] + To_Carry
TO_CARRY := result//10
last_digit := mod(result, 10)
required_line := last_digit . required_line
}
TO_CARRY := 0
loop, % zeroes - 1
zeroes_ .= "0"
;~ MsgBox % required_line . zeroes_
lines_by_lines := strsplit(required_line . zeroes_)
;~ MsgBox % lines_by_lines[1]
;=========final line processing =====ADDITION====================
;~ MsgBox % "new total is:" . "`n" . end_result
if ( A_index = 1 )
{
;~ MsgBox % is_this_the_Result . "`n" . A_index . "`n" . checking_last_Step
array_Total := strsplit(end_Result)
loop % array_Total.maxindex()+1
end_result .= "0"
array_Total := strsplit(end_result)
}
loop, % array_Total.maxindex() > lines_by_lines.maxindex() ? array_Total.maxindex() : lines_by_lines.maxindex()
{
;~ MsgBox % array_Total.maxindex() > lines_by_lines.maxindex() ? array_Total.maxindex() : lines_by_lines.maxindex()
if ( array_Total[array_Total.maxindex()-A_index+1] = "" )
array_Total[array_Total.maxindex()-A_index+1] := 0
;~ MsgBox % array_Total[array_Total.maxindex()-A_index+1]
;~ MsgBox % array_Total[array_Total.maxindex()-A_index+1] . "wwwww`n" . lines_by_lines[lines_by_lines.maxindex()-A_index+1] . "qqqqq`n" . carry_carry . "eee"
ADD_last_digits := lines_by_lines[lines_by_lines.maxindex()-A_index+1] + array_Total[array_Total.maxindex()-A_index+1] + carry_carry
last_last_digit := mod(ADD_last_digits,10)
carry_Carry :=ADD_last_digits//10
is_this_the_Result := last_last_digit . is_this_the_Result
}
array_Total := strsplit(is_this_the_Result)
checking_last_Step := is_this_the_Result
;~ MsgBox % is_this_the_Result . "`n" . A_index . "`n" . checking_last_Step
is_this_the_Result := ""
carry_carry := 0
;===============================================
zeroes := ""
required_line := ""
zeroes_ := ""
}
;==================
end_Result := RegExReplace(checking_last_Step, "(0)?(\d+)", "$2") ;==================================================================================IMPORTANT
;~ end_result := checking_last_step
if ( power -1 = A_index )
{
;~ checking_alst_Step :=
MsgBox % input_number . "**" . power . ":`n" . checking_last_step
ExitApp
}
;~ end_Result := RegExReplace(end_Result, "\d", "0")
array_Total := strsplit(end_Result)
}
;~ MsgBox % end_Result := "0" . checking_last_Step
ExitApp
esc::ExitApp