All pastes #19069 Raw Edit

Something

public text v1 · immutable
#19069 ·published 2005-08-02 11:17 UTC
rendered paste body
Function Calc2(A_, B_: String; xxx: boolean; gora_: integer): String;
Var
  i, j, k           : integer;
  a, b, tempp, c, d : String;
  temp1, temp2, temp: byte;
  r                 : String;
  gora              : integer;
  dodajgore         : boolean;
Begin
  If Length(a_) > Length(b_) Then
  Begin
    a := a_;
    b := b_;
  End
  Else
  Begin
    a := b_;
    b := a_;
  End;
  If length(a_) = Length(b_) Then
    For i := 1 To Length(A_) Do
      If strtoint(a_[i]) > strtoint(b_[i]) Then
      Begin
        a := a_;
        b := b_;
        break;
      End
      Else
      Begin
        b := a_;
        a := b_;
      End;
  gora := 0;
  dodajgore := false;
  c := a;
  d := b;
  For i := 1 To length(a) - length(b) Do
    b := '0' + b;
  For i := length(a) Downto 1 Do
  Begin
    temp1 := strtoint(a[i]);
    temp2 := strtoint(b[i]);
    temp := temp1 + temp2;
    tempp := inttostr(temp);
    If length(tempp) >= 2 Then
    Begin
      If gora_ <> 0 Then
        gora := gora + gora_ + strtoint(copy(tempp, 1, length(tempp) - 1))
      Else
        gora := gora + strtoint(copy(tempp, 1, length(tempp) - 1));
      dodajgore := true;
    End;
    form1.listbox1.items.add('G' + inttostr(gora) + ' R' + r); //debug :P
    If dodajgore Then
    Begin
      r := inttostr(temp) + calc2(r, inttostr(gora - 1), dodajgore, gora);
      dodajgore := false;
      gora := 0;
    End
    Else
      r := tempp[length(tempp)] + r;
  End;
  result := r;
End;