首页
社区
课程
招聘
这段程序是那种语言写的啊,能把它改用 C 写一次吗?
2006-6-28 21:55 3902

这段程序是那种语言写的啊,能把它改用 C 写一次吗?

2006-6-28 21:55
3902
程序应该很简单的,就是在循环部分语法不会看(只学过 C) ,那位高手能帮我改为 C 程序啊,先谢谢了

{$APPTYPE CONSOLE}

Uses
SysUtils;

var nome,serial:string;
  i,j:integer;

begin
writeln('######## Keygen for Step 2 by The Hellfish ########');
writeln;
write('Enter your name: '); readln(nome);
writeln;
if length(nome)>=4 then begin
          j:=1;
          for i:=1 to length(nome) do nome:=upcase(nome);
          for i:=1 to 8 do
          if nome<>#0 then
          serial:=serial+inttohex(ord(nome)xor (80+i-1),2)
          else begin
          serial:=serial+inttohex(ord(nome[j])xor (80+i-1),2);
          j:=j+1;
          end;
          writeln('Your code is: '+serial);
          writeln;
          writeln('#### Lie, Cheat and Steal! ####');
          end
else
writeln('You must type at least 4 chars!!!');
readln;
end.

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
点赞0
打赏
分享
最新回复 (3)
雪    币: 2367
活跃值: (756)
能力值: (RANK:410 )
在线值:
发帖
回帖
粉丝
小虾 10 2006-6-28 22:57
2
0
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

#pragma comment(lib,"Kernel32.lib")
#pragma comment(lib,"User32.lib")

char* IntToHex(char c, char* cBuff, char* cFormat)
{
        wsprintf(cBuff,cFormat,c);
        return cBuff;
}

int main()
{
        char nome[256]={0};
        char serial[256]={0};
        char tmp[4] = {0};
        int i,j,iLen;
        printf("######## Keygen for Step 2 by The Hellfish ########\n");
        printf("Enter your name: "); scanf("%s",&nome);
        iLen = lstrlen(nome);
        if (iLen >= 4)
        {
                j = 0;
                strupr(nome);
                for (i = 0; i < 8; i++)
                {
                        if (nome[i] != 0)
                                lstrcat(serial,IntToHex(nome[i] ^ (80 + i),tmp,"%02X"));
                        else
                        {
                                lstrcat(serial,IntToHex(nome[j] ^ (80 + i),tmp,"%02X"));
                                j++;
                        }
                }
                printf("\nYour code is: %s\n",serial);
                printf("#### Lie, Cheat and steal! ####\n");
               
        }
        else
                printf("You must type at least 4 chars!!!\n");
        system("pause");
        return 0;
}
雪    币: 110
活跃值: (13)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
小剑 2006-6-28 23:18
3
0
谢谢大虾啊,转成C一看就明了,再次感谢版主
雪    币: 181
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
foretell 2006-7-2 16:23
4
0
delphi写的 2楼 大虾叔 真牛什么 语言都会!
游客
登录 | 注册 方可回帖
返回