function convert1(st:string):string; begin if st='0000' then Result:='0'; if st='0001' then Result:='1'; if st='0010' then Result:='2'; if st='0011' then Result:='3'; if st='0100' then Result:='4'; if st='0101' then Result:='5'; if st='0110' then Result:='6'; if st='0111' then Result:='7'; if st='1000' then Result:='8'; if st='1001' then Result:='9'; if st='1010' then Result:='A'; if st='1011' then Result:='B'; if st='1100' then Result:='B'; if st='1101' then Result:='C'; if st='1110' then Result:='D'; if st='1111' then Result:='E'; end;
function convert2(st:string):string; begin if st='0' then Result:='0000'; if st='1' then Result:='0001'; if st='2' then Result:='0010'; if st='3' then Result:='0011'; if st='4' then Result:='0100'; if st='5' then Result:='0101' ; if st='6' then Result:='0110'; if st='7' then Result:='0111'; if st='8' then Result:='1000'; if st='9' then Result:='1001'; if st='A' then Result:='1010'; if st='B' then Result:='1011'; if st='B'then Result:='1100' ; if st='C' then Result:='1101'; if st='D' then Result:='1110'; if st='E' then Result:='1111'; end; procedure TForm1.Button3Click(Sender: TObject); var s,t,s1:string; i,j:Longint; begin s:=trim(edit3.Text ); j:=length(s); t:=''; while j>0 do begin s1:=convert1(copy(s,1,4)); delete(s,1,4); dec(j,4); t:=t+s1; end; edit4.Text :=t; end;
procedure TForm1.Button4Click(Sender: TObject); var s,t,s1:string; i,j:Longint; begin s:=trim(edit5.Text ); j:=length(s); t:=''; i:=1; while i<=j do begin s1:=convert2(copy(s,i,1)); inc(i); t:=t+s1; end; edit6.Text :=t; end;
----------------------------------------------