Chắc suất Đại học top - Giữ chỗ ngay!! ĐĂNG BÀI NGAY để cùng trao đổi với các thành viên siêu nhiệt tình & dễ thương trên diễn đàn.
uses crt, graph;
var gd, gm, i, x, y, m, j : integer;
p1, p2, p3, p4, p5 : pointer;
size1, size2, size3, size4, size5 : word;
begin
gd:=9;
gm:=2;
initgraph(gd,gm,'C:\TPWDB\BGI');
setbkcolor(15);
cleardevice;
settextstyle(1,0,2);
settextjustify(1,1);
setcolor(12);
outtextxy(320,240,'Xin Chao');
delay(1000);
cleardevice;
randomize;
x:=random(641);
y:=random(481);
inc(x);inc(y);
for i:=1 to 4 do begin
dec(x);dec(y);
putpixel(x,y,4);
end;
inc(x,3);
inc(y,3);
for i:=1 to 3 do begin
inc(x);dec(y);
putpixel(x,y,4);
end;
setcolor(12);
line(x-5,y-3,x-4,y-3);
setcolor(12);
line(x-2,y-3,x-1,y-3);
putpixel(x,y-1,12);
putpixel(x,y-2,12);
putpixel(x-6,y-1,12);
putpixel(x-6,y-2,12);
setfillstyle(1,12);
bar(x-5,y-2,x-1,y);
setcolor(12);
line(x-4,y+1,x-2,y+1);
setcolor(12);
putpixel(x-3,y+2,12);
putpixel(x-5,y-2,15);
size1:=imagesize(x-6,y-3,x,y+3);
getmem(p1,size1);
getimage(x-6,y-3,x,y+3,p1^);
cleardevice;
for j:=2 to 5 do begin
x:=random(641);
y:=random(481);
inc(x,j);inc(y,j);
setfillstyle(1,4);
for i:=1 to 4 do begin
dec(x,j);dec(y,j);
bar(x,y,x+j-1,y+j-1);
end;
inc(x,3*j);
inc(y,3*j);
for i:=1 to 3 do begin
inc(x,j);dec(y,j);
bar(x,y,x+j-1,y+j-1);
end;
setfillstyle(1,12);
bar(x-(5*j),y-(2*j),x-1,y+j-1);
bar(x-(4*j),y+j,x-j-1,y+(2*j)-1);
bar(x-(3*j),y+(j*2),x-(2*j)-1,y+(3*j)-1);
bar(x-(6*j),y-(2*j),x+j-1,y-1);
bar(x-(5*j),y-(3*j),x-(3*j)-1,y-(2*j)-1);
bar(x-(2*j),y-(3*j),x-1,y-(2*j)-1);
setfillstyle(1,15);
bar(x-(5*j),y-(2*j),x-(4*j)-1,y-j-1);
if j=2 then begin
size2:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p2,size2);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p2^);
end else if j=3 then begin
size3:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p3,size3);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p3^);
end else if j=4 then begin
size4:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p4,size4);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p4^);
end else if j=5 then begin
size5:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p5,size5);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p5^);
end;
cleardevice;
end;
setbkcolor(15);
randomize;
repeat begin
m:=random(5)+1;
x:=random(641);
y:=random(481);
if m=1 then
putimage(x,y,p1^,0) else
if m=2 then
putimage(x,y,p2^,0) else
if m=3 then
putimage(x,y,p3^,0) else
if m=4 then
putimage(x,y,p4^,0) else
if m=5 then
putimage(x,y,p5^,0);
delay(100);
end until keypressed;
end.
var gd, gm, i, x, y, m, j : integer;
p1, p2, p3, p4, p5 : pointer;
size1, size2, size3, size4, size5 : word;
begin
gd:=9;
gm:=2;
initgraph(gd,gm,'C:\TPWDB\BGI');
setbkcolor(15);
cleardevice;
settextstyle(1,0,2);
settextjustify(1,1);
setcolor(12);
outtextxy(320,240,'Xin Chao');
delay(1000);
cleardevice;
randomize;
x:=random(641);
y:=random(481);
inc(x);inc(y);
for i:=1 to 4 do begin
dec(x);dec(y);
putpixel(x,y,4);
end;
inc(x,3);
inc(y,3);
for i:=1 to 3 do begin
inc(x);dec(y);
putpixel(x,y,4);
end;
setcolor(12);
line(x-5,y-3,x-4,y-3);
setcolor(12);
line(x-2,y-3,x-1,y-3);
putpixel(x,y-1,12);
putpixel(x,y-2,12);
putpixel(x-6,y-1,12);
putpixel(x-6,y-2,12);
setfillstyle(1,12);
bar(x-5,y-2,x-1,y);
setcolor(12);
line(x-4,y+1,x-2,y+1);
setcolor(12);
putpixel(x-3,y+2,12);
putpixel(x-5,y-2,15);
size1:=imagesize(x-6,y-3,x,y+3);
getmem(p1,size1);
getimage(x-6,y-3,x,y+3,p1^);
cleardevice;
for j:=2 to 5 do begin
x:=random(641);
y:=random(481);
inc(x,j);inc(y,j);
setfillstyle(1,4);
for i:=1 to 4 do begin
dec(x,j);dec(y,j);
bar(x,y,x+j-1,y+j-1);
end;
inc(x,3*j);
inc(y,3*j);
for i:=1 to 3 do begin
inc(x,j);dec(y,j);
bar(x,y,x+j-1,y+j-1);
end;
setfillstyle(1,12);
bar(x-(5*j),y-(2*j),x-1,y+j-1);
bar(x-(4*j),y+j,x-j-1,y+(2*j)-1);
bar(x-(3*j),y+(j*2),x-(2*j)-1,y+(3*j)-1);
bar(x-(6*j),y-(2*j),x+j-1,y-1);
bar(x-(5*j),y-(3*j),x-(3*j)-1,y-(2*j)-1);
bar(x-(2*j),y-(3*j),x-1,y-(2*j)-1);
setfillstyle(1,15);
bar(x-(5*j),y-(2*j),x-(4*j)-1,y-j-1);
if j=2 then begin
size2:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p2,size2);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p2^);
end else if j=3 then begin
size3:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p3,size3);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p3^);
end else if j=4 then begin
size4:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p4,size4);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p4^);
end else if j=5 then begin
size5:=imagesize(x-6*j,y-3*j,x+j-1,y+4*j-1);
getmem(p5,size5);
getimage(x-6*j,y-3*j,x+j-1,y+4*j-1,p5^);
end;
cleardevice;
end;
setbkcolor(15);
randomize;
repeat begin
m:=random(5)+1;
x:=random(641);
y:=random(481);
if m=1 then
putimage(x,y,p1^,0) else
if m=2 then
putimage(x,y,p2^,0) else
if m=3 then
putimage(x,y,p3^,0) else
if m=4 then
putimage(x,y,p4^,0) else
if m=5 then
putimage(x,y,p5^,0);
delay(100);
end until keypressed;
end.