Z
zaorv
Unregistered / Unconfirmed
GUEST, unregistred user!
Example: input= FAPGDC501H1TOSH[blue]00320011049800[/blue][red]5[/red]CN0011728001for i=16 to 28 currentDigit = cint(mid(input,i,1) ) if odd then sum = sum +currentDigit else if currentDigit * 2 > 9 then sum =sum + (currentDigit*2 -9) else sum = sum + (currentDigit * 2 ) end if end if odd = not oddnext 將上面代碼轉換成DELPHI 的代碼 for i := 16 to 28 do begin currentDigit := strToInt( copy(input,i,1) ) ; if odd(currentDigit) then begin sum := sum + currentDigit; end else begin if currentDigit*2>9 then begin sum := sum + (currentDigit*2 -9) end else begin sum := sum + ( currentDigit*2 ) end; end; end;以上轉換正確嗎?