谁能帮我译一下C语言???(50分)

  • 主题发起人 主题发起人 rzqcjwrz
  • 开始时间 开始时间
R

rzqcjwrz

Unregistered / Unconfirmed
GUEST, unregistred user!
//字段解密<br>int recover(char * src,char *dest)<br>{<br> char ch;<br> int i=0;<br> ch=*(src+i);<br> while(ch!=0)<br> {<br> ch=ch-4;<br> if (ch&lt;0) ch+=256;<br> *(dest+i)=ch;<br> i++;<br> ch=*(src+i);<br> }<br> *(dest+i)=0;<br> return i;<br>}
 
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; btn1: TButton;<br>&nbsp; &nbsp; edt1: TEdit;<br>&nbsp; &nbsp; edt2: TEdit;<br>&nbsp; &nbsp; procedure btn1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>//字段解密<br>function recover(src: PAnsiChar; dest: PAnsiChar): Integer;<br>var<br>&nbsp; ch: Char;<br>&nbsp; i: Integer;<br>begin<br>&nbsp; i := 0;<br>&nbsp; ch := src;<br>&nbsp; while (ch &lt;&gt; #0) do<br>&nbsp; begin<br>&nbsp; &nbsp; ch := Char(Integer(ch) - 4);<br>&nbsp; &nbsp; if (ch &lt; #0) then<br>&nbsp; &nbsp; &nbsp; ch := Char(Integer(ch) + 256);<br>&nbsp; &nbsp; dest := ch;<br><br>&nbsp; &nbsp; Inc(i);<br>&nbsp; &nbsp; ch := src;<br>&nbsp; end;<br>&nbsp; dest := #0;<br>&nbsp; Result := i;<br>end;<br><br>procedure TForm1.btn1Click(Sender: TObject);<br>var<br>&nbsp; buff: array [0..255] of Char;<br>begin<br>&nbsp; recover(PAnsiChar(edt1.Text), buff);<br>&nbsp; edt2.Text := buff;<br>end;<br><br>end.
 

Similar threads

I
回复
0
查看
1K
import
I
I
回复
0
查看
586
import
I
I
回复
0
查看
742
import
I
后退
顶部