这样说吧,有两个数组,A[ i ] 和 B[ i ] ,A[ i ]存放的是字符串A
B[ i ]存放的是翻转后的字符串A,比如说A='0123456789'那么翻转后就是'9876543210'
逐位查找用户输入的注册码在B[ i ]的位置,然后从A[ i ]中取出同样位置的字符,组成字符串
然后和机器码2行比较,相同则住则注册成功。
如果还觉得我没说清楚就在注册机里输入"zyxwvutsrqponmlk"生成注册码看看吧
下面是注册机的部分源码(DELPHI):
procedure TForm1.Label1Click(Sender: TObject);
var
s1,s2,tmp:string;
i,n:integer;
begin
tmp:=adpedit1.Text;
if tmp='此处填写机器码' then
adpedit1.text:='请填写机器码'
else if tmp='' then
adpedit1.text:='机器码不能为空'
else if length(tmp)<>16 then
adpedit1.text:='机器码长度必须为16位'
else
begin
adpedit2.Text:='';
s1:='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
for n:=1 to length(tmp) do
begin
s2:=midstr(tmp,n,1);
i:=AnsiIndexStr(s2,['z','y','x','w','v','u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b','a','Z','Y','X','W','V','U','T','S','R','Q','P','O','N','M','L','K','J','I','H','G','F','E','D','C','B','A','9','8','7','6','5','4','3','2','1','0']);
adpedit2.Text:=adpedit2.Text+midstr(s1,i+1,1);
end;
adpedit2.Enabled:=true;
end;
end;