將字串轉成二進位再一一做XOR運算 |
答題得分者是:ddy
|
dreamingfom
一般會員 發表:4 回覆:8 積分:2 註冊:2003-08-18 發送簡訊給我 |
|
ddy
站務副站長 發表:262 回覆:2105 積分:1169 註冊:2002-07-13 發送簡訊給我 |
function IntToBin(Value: Longint; Digits: Integer): string; var i: Integer; begin Result := ''; for i := Digits downto 0 do if Value and (1 shl i) <> 0 then Result := Result + '1' else Result := Result + '0'; end; procedure TForm1.Button1Click(Sender: TObject); var s: string; i: Integer; begin s := 'abcdefg'; for i := 1 to Length(s) - 1 do begin ListBox1.Items.Add(inttobin(ord(s[i]) xor ord(s[i + 1]), 8)); end; end;一、不需要轉成二進位也能運算 二、不知您的用途是什麼? 這樣子的運算義意不大,因為c的結果是 #3#1#7#1#3#1 無法還原成'abcdefg' 看似不是編碼用途 三、若要二進制轉換,可參考這二篇 二進制與十進制互相轉換.. http://delphi.ktop.com.tw/topic.php?topic_id=18283 請問二進制資料與ASCII之間的資料如何轉換 http://delphi.ktop.com.tw/topic.php?topic_id=22972 |
dreamingfom
一般會員 發表:4 回覆:8 積分:2 註冊:2003-08-18 發送簡訊給我 |
|
hcker
中階會員 發表:95 回覆:118 積分:62 註冊:2003-02-09 發送簡訊給我 |
|
dreamingfom
一般會員 發表:4 回覆:8 積分:2 註冊:2003-08-18 發送簡訊給我 |
|
hcker
中階會員 發表:95 回覆:118 積分:62 註冊:2003-02-09 發送簡訊給我 |
|
ddy
站務副站長 發表:262 回覆:2105 積分:1169 註冊:2002-07-13 發送簡訊給我 |
|
dreamingfom
一般會員 發表:4 回覆:8 積分:2 註冊:2003-08-18 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |