chip_pro_95
New Member
mỗi khi chạy thì pascal lại báo prpgram............ exited with exitcode = 201 hết mong các bn tìm zúp mình lỗi sai
program ranbo;
uses crt,dos;
type
TPoint=record
x,y:byte;
end;
ran=array[1..100] of TPoint; {toi khai báo lai cho de coi}
var
conran:ran;
x,y, x1,y1, l, huong :byte;
tocdo, diem :integer;
kt :char; {k0 dùng}
ranchet :boolean;
{-------------------------------------------------------}
procedure setcusor(bot,top:byte);
var
regs:registers;
begin
regs.ah:=1; regs.ch:=bot; regs.cl:=top;
intr($10,regs);
end;
{-------------------------------------------------------}
procedure ngaunhien;
begin
x1:=random(30)+5; y1:=random(20)+2;
kt:=chr(random(25)+65);
gotoxy(x1,y1); write(kt);
end;
{-------------------------------------------------------}
procedure vekhung;
var
j:byte;
begin
clrscr;
textcolor(white);
gotoxy(1,1);
for j:=1 to 40 do write(#177);
gotoxy(1,24);
for j:=1 to 40 do write(#177);
for j:=2 to 24 do
begin
gotoxy(1,j); write(#177);
gotoxy(40,j);write(#177);
end;
gotoxy(8,24);
textcolor(lightred);
writeln('Nhap phim Esc de thoat');
end;
{-------------------------------------------------------}
procedure ranchay;
var rk:char;
begin
if keypressed then {neu an co an phim thi}
begin
rk:=readkey; {ban thieu} {doc xem phím nào vua bam}
if rk=#27 then halt(1); {neu la esc thoat}
if rk=#0 then rk:=readkey; {neu la phim dieu khien(control key), doc lai de lay ma}
huong:=ord(rk);
end;
case huong of
80: inc(y);
72: dec(y);
77: inc(x);
75: dec(x);
end;
if (y=1) or(y=24) or(x=40) or(x=1) then ranchet:=true;
end;
{-------------------------------------------------------}
procedure init;
var
j:byte;
begin
randomize;
textmode(co40);
tocdo:=200;
diem:=0;
vekhung;
l:=3;
x:=10;y:=10;
huong:=0; {+ nen khoi tao huong}
for j:=1 to l+1 do
begin
conran[j].x:=30+j; conran[j].y:=10;
end;
ngaunhien;
setcusor(32,3);
ranchet:=false;
end;
{-------------------------------------------------------}
procedure thuchien;
var
i:byte;
begin
init;
i:=4;
repeat
ranchay;
dec(i);
gotoxy(conran.x,conran.y);
write(' ');
conran.x:=x; conran.y:=y;
textcolor(lightred);
gotoxy(4,1);
write(' DIEM ',diem);
if (diem>0) and ( diem mod 200=0) then
begin
diem:=diem+50;
gotoxy(6,12);
textcolor(white);
textbackground(red);
writeln('KHA LAM ! = MOI BAN TIEP TUC');
repeat until keypressed;
textbackground(0);
clrscr;
vekhung;
if tocdo>=100 then tocdo:=tocdo-50;
if diem>=400 then l:=3;
i:=l;
end;
if (x=x1) and (y=y1) then
begin
l:=l+1; ngaunhien;
diem:=diem+10;
end;
gotoxy(x1,y1);
write(kt);
textcolor(lightcyan);
gotoxy(conran.x,conran.y);
write(#219);
if i=1 then i:=l+1;
delay(tocdo);
until ranchet;
gotoxy(15,11); write(' BAN DA THUA ');
gotoxy(5,12);
write(' Nhan phim bat ki de choi tiep ');
end;
{-------------------------------------------------------}
BEGIN
repeat
clrscr;
thuchien;
kt:=readkey;
until kt=#27;
clrscr;
END.
Thank các bạn rất nhiều mong các bạn giúp
program ranbo;
uses crt,dos;
type
TPoint=record
x,y:byte;
end;
ran=array[1..100] of TPoint; {toi khai báo lai cho de coi}
var
conran:ran;
x,y, x1,y1, l, huong :byte;
tocdo, diem :integer;
kt :char; {k0 dùng}
ranchet :boolean;
{-------------------------------------------------------}
procedure setcusor(bot,top:byte);
var
regs:registers;
begin
regs.ah:=1; regs.ch:=bot; regs.cl:=top;
intr($10,regs);
end;
{-------------------------------------------------------}
procedure ngaunhien;
begin
x1:=random(30)+5; y1:=random(20)+2;
kt:=chr(random(25)+65);
gotoxy(x1,y1); write(kt);
end;
{-------------------------------------------------------}
procedure vekhung;
var
j:byte;
begin
clrscr;
textcolor(white);
gotoxy(1,1);
for j:=1 to 40 do write(#177);
gotoxy(1,24);
for j:=1 to 40 do write(#177);
for j:=2 to 24 do
begin
gotoxy(1,j); write(#177);
gotoxy(40,j);write(#177);
end;
gotoxy(8,24);
textcolor(lightred);
writeln('Nhap phim Esc de thoat');
end;
{-------------------------------------------------------}
procedure ranchay;
var rk:char;
begin
if keypressed then {neu an co an phim thi}
begin
rk:=readkey; {ban thieu} {doc xem phím nào vua bam}
if rk=#27 then halt(1); {neu la esc thoat}
if rk=#0 then rk:=readkey; {neu la phim dieu khien(control key), doc lai de lay ma}
huong:=ord(rk);
end;
case huong of
80: inc(y);
72: dec(y);
77: inc(x);
75: dec(x);
end;
if (y=1) or(y=24) or(x=40) or(x=1) then ranchet:=true;
end;
{-------------------------------------------------------}
procedure init;
var
j:byte;
begin
randomize;
textmode(co40);
tocdo:=200;
diem:=0;
vekhung;
l:=3;
x:=10;y:=10;
huong:=0; {+ nen khoi tao huong}
for j:=1 to l+1 do
begin
conran[j].x:=30+j; conran[j].y:=10;
end;
ngaunhien;
setcusor(32,3);
ranchet:=false;
end;
{-------------------------------------------------------}
procedure thuchien;
var
i:byte;
begin
init;
i:=4;
repeat
ranchay;
dec(i);
gotoxy(conran.x,conran.y);
write(' ');
conran.x:=x; conran.y:=y;
textcolor(lightred);
gotoxy(4,1);
write(' DIEM ',diem);
if (diem>0) and ( diem mod 200=0) then
begin
diem:=diem+50;
gotoxy(6,12);
textcolor(white);
textbackground(red);
writeln('KHA LAM ! = MOI BAN TIEP TUC');
repeat until keypressed;
textbackground(0);
clrscr;
vekhung;
if tocdo>=100 then tocdo:=tocdo-50;
if diem>=400 then l:=3;
i:=l;
end;
if (x=x1) and (y=y1) then
begin
l:=l+1; ngaunhien;
diem:=diem+10;
end;
gotoxy(x1,y1);
write(kt);
textcolor(lightcyan);
gotoxy(conran.x,conran.y);
write(#219);
if i=1 then i:=l+1;
delay(tocdo);
until ranchet;
gotoxy(15,11); write(' BAN DA THUA ');
gotoxy(5,12);
write(' Nhan phim bat ki de choi tiep ');
end;
{-------------------------------------------------------}
BEGIN
repeat
clrscr;
thuchien;
kt:=readkey;
until kt=#27;
clrscr;
END.
Thank các bạn rất nhiều mong các bạn giúp