0
029
Unregistered / Unconfirmed
GUEST, unregistred user!
我以前一直学PASCAL(竞赛用)
我对DELPHI很生,我想把这个PASCAL程序转成DELPHI,用不用重写源码了?
需要哪些预备知识?
请详谈!谢谢!!
pascal 源程序:
{陕西风采投注查询}
uses crt;
label 1;
var table:text;
a:array[0..8000,1..8]of 1..33;
b:array[1..6]of integer;
s:set of 1..33;
sum,p,sp,k,n,n1,i,j:integer;
base:0..7;
spe:0..1;
cha:char;
procedure input(k:string);
begin
assign(table,k);
{$I-}
reset(table);
{$I+}
if IOResult = 0 then
else
Writeln('数据没有找到!');
for i:=1 to 8000 do
for j:=1 to 8 do read(table,a[i,j]);
if (a[8000,2]<>0)and(a[8000,3]<>0) then begin writeln('Too Large!');halt;end;
for i:=1 to 8000 do
if (a[i,2]=0)and(a[i,3]=0)and(a[i,4]=0) then begin n:=i-1;exit;end;
end;
Procedure out(bee:integer);
Begin
inc(sum);
write('No.',i:4,': ');
for p:=2 to 8 do write(a[i,p]:4);
if sum mod 25=0 then begin
if bee<=3 then textcolor(4)
else textcolor(lightgreen);
write(' (',bee,'等奖)');
textcolor(white);
end
else
begin
if bee<=3 then textcolor(4)
else textcolor(lightgreen);
writeln(' (',bee,'等奖)');
textcolor(white);
end;
inc(b[bee]);
if sum mod 25 =0 then begin cha:=readkey;writeln;end;
End;
Procedure Check(a,b:integer);
Begin
Case a of
3:if b=1 then out(6);
4ut(6);
5:if b=1 then out(4) else out(5);
6:if b=1 then out(2) else out(3);
7ut(1);
end;
End;
begin
clrscr;
textcolor(lightgreen);
writeln;
writeln;
writeln('投注查询':42);
writeln;
textcolor(white);
sum:=0;
input('lhb.txt');
1:
n1:=0;
s:=[];
write(' 请输入7位基本号码:');
repeat
inc(n1);
read(k);
if k in s then begin
writeln;
writeln(' 输入错误!');
writeln;
goto 1;
end;
s:=s+[k];
until eoln;
if n1<>7 then
begin
writeln;
writeln(' 输入错误!');
writeln;
goto 1;
end;
repeat;
writeln;
write(' 请输入特别号码:');
readln(sp);
if sp in S then begin writeln;writeln(' 输入错误!');end;
until not (sp in s);
clrscr;
for i:=1 to n do
begin
base:=0;
spe:=0;
for j:=2 to 8 do
begin
if a[i,j] in s then inc(base);
if a[i,j]=sp then spe:=1;
end;
if base>=3 then check(base,spe);
end;
textcolor(LightRed+Blink);
writeln('按任意键查看中奖结果!');
cha:=readkey;
textcolor(white);
clrscr;
for i:=4 to 6 do writeln(i,'等奖:',b:3,'注');
writeln;
write('投注总数:');
textcolor(11);
writeln(n:4,'注');
textcolor(white);
write('中奖总数:');
textcolor(13);
writeln(sum:4,'注');
for i:=1 to 3 do
if b<>0 then begin
textcolor(lightred);
gotoxy(30,12+i-1);
writeln('恭喜您中了',i,'等奖',b,'注!');
textcolor(white);
end;
if(b[1]=0)and(b[2]=0)and(b[3]=0) then
begin
textcolor(lightgreen);
gotoxy(26,13);
writeln('革命尚未成功,同志仍需努力!');
textcolor(white);
end;
end.
我对DELPHI很生,我想把这个PASCAL程序转成DELPHI,用不用重写源码了?
需要哪些预备知识?
请详谈!谢谢!!
pascal 源程序:
{陕西风采投注查询}
uses crt;
label 1;
var table:text;
a:array[0..8000,1..8]of 1..33;
b:array[1..6]of integer;
s:set of 1..33;
sum,p,sp,k,n,n1,i,j:integer;
base:0..7;
spe:0..1;
cha:char;
procedure input(k:string);
begin
assign(table,k);
{$I-}
reset(table);
{$I+}
if IOResult = 0 then
else
Writeln('数据没有找到!');
for i:=1 to 8000 do
for j:=1 to 8 do read(table,a[i,j]);
if (a[8000,2]<>0)and(a[8000,3]<>0) then begin writeln('Too Large!');halt;end;
for i:=1 to 8000 do
if (a[i,2]=0)and(a[i,3]=0)and(a[i,4]=0) then begin n:=i-1;exit;end;
end;
Procedure out(bee:integer);
Begin
inc(sum);
write('No.',i:4,': ');
for p:=2 to 8 do write(a[i,p]:4);
if sum mod 25=0 then begin
if bee<=3 then textcolor(4)
else textcolor(lightgreen);
write(' (',bee,'等奖)');
textcolor(white);
end
else
begin
if bee<=3 then textcolor(4)
else textcolor(lightgreen);
writeln(' (',bee,'等奖)');
textcolor(white);
end;
inc(b[bee]);
if sum mod 25 =0 then begin cha:=readkey;writeln;end;
End;
Procedure Check(a,b:integer);
Begin
Case a of
3:if b=1 then out(6);
4ut(6);
5:if b=1 then out(4) else out(5);
6:if b=1 then out(2) else out(3);
7ut(1);
end;
End;
begin
clrscr;
textcolor(lightgreen);
writeln;
writeln;
writeln('投注查询':42);
writeln;
textcolor(white);
sum:=0;
input('lhb.txt');
1:
n1:=0;
s:=[];
write(' 请输入7位基本号码:');
repeat
inc(n1);
read(k);
if k in s then begin
writeln;
writeln(' 输入错误!');
writeln;
goto 1;
end;
s:=s+[k];
until eoln;
if n1<>7 then
begin
writeln;
writeln(' 输入错误!');
writeln;
goto 1;
end;
repeat;
writeln;
write(' 请输入特别号码:');
readln(sp);
if sp in S then begin writeln;writeln(' 输入错误!');end;
until not (sp in s);
clrscr;
for i:=1 to n do
begin
base:=0;
spe:=0;
for j:=2 to 8 do
begin
if a[i,j] in s then inc(base);
if a[i,j]=sp then spe:=1;
end;
if base>=3 then check(base,spe);
end;
textcolor(LightRed+Blink);
writeln('按任意键查看中奖结果!');
cha:=readkey;
textcolor(white);
clrscr;
for i:=4 to 6 do writeln(i,'等奖:',b:3,'注');
writeln;
write('投注总数:');
textcolor(11);
writeln(n:4,'注');
textcolor(white);
write('中奖总数:');
textcolor(13);
writeln(sum:4,'注');
for i:=1 to 3 do
if b<>0 then begin
textcolor(lightred);
gotoxy(30,12+i-1);
writeln('恭喜您中了',i,'等奖',b,'注!');
textcolor(white);
end;
if(b[1]=0)and(b[2]=0)and(b[3]=0) then
begin
textcolor(lightgreen);
gotoxy(26,13);
writeln('革命尚未成功,同志仍需努力!');
textcolor(white);
end;
end.