• 标 题:3DMark2001注册机源代码(C++ Build 5.0编译通过) (1千字)
  • 作 者:时空幻影
  • 时 间:2001-4-18 14:37:05
  • 链 接:http://bbs.pediy.com

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button1Click(TObject *Sender)
{
  AnsiString Passcode="ABCDEFHJKLMNPQRSTUVWXYZ0123456789";
  AnsiString r;
  AnsiString s1,s2,s3,s4;
  int i,k,t1,t2,t3,m[5];
  if (Edit1->Text=="") r="shikonghuanying@sina.com";
    else
      {
        r=Edit1->Text.Delete(6,2);
        r=r.Delete(11,2);
        r=r.Delete(16,2);
        r=r.Delete(3,1);
      }
  for (i=1,t1=0;i<5;i++)
    {
      k=int(r[i])%0x21;
      t1=t1+k;
      s1=s1+Passcode[k+1];
    }
  s1=s1+Passcode[t1%0x21+1];
  for (i=6,t2=0;i<10;i++)
    {
      k=int(r[i])%0x21;
      t2=t2+k;
      s2=s2+Passcode[k+1];
    }
  s2=s2+Passcode[t2%0x21+1];
  for (i=11,t3=0;i<15;i++)
    {
      k=int(r[i])%0x21;
      t3=t3+k;
      s3=s3+Passcode[k+1];
    }
  s3=s3+Passcode[t3%0x21+1];
  m[0]=(t1+t2+t3)%0x21;
  m[1]=(t2+t3+m[0])%0x21;
  m[2]=(t3+m[0]+m[1])%0x21;
  m[3]=(m[0]+m[1]+m[2])%0x21;
  m[4]=(m[1]+m[2]+m[3])%0x21;
  s4+=Passcode[m[0]+1];
  s4+=Passcode[m[1]+1];
  s4+=Passcode[m[2]+1];
  s4+=Passcode[m[3]+1];
  s4+=Passcode[m[4]+1];
  Edit1->Text=s1+"-"+s2+"-"+s3+"-"+s4;
}
//---------------------------------------------------------------------------