program pozicionalos; uses graph, crt; var gd,gm,szin,h:integer; i,j:shortint; c:char; as,bs,kxs,kys,sz:string; hiba:boolean; a,b,kx,ky:word; function readtxt(x,y:integer;sz:string):string; var c:char; szov:string; begin szov:=''; outtextxy(x,y,sz); c:=readkey; repeat if (c=#8) and (length(szov)>0) then begin setfillstyle(1,black); bar(x+textwidth(sz),y,x+textwidth(szov+sz),y+textheight(szov)); szov:=copy(szov,1,length(szov)-1); outtextxy(x+textwidth(sz),y,szov); end else begin if c<>#8 then begin szov:=szov+c; outtextxy(x+textwidth(sz),y,szov); end; end; c:=readkey; until c=#13; readtxt:=szov; end; begin detectgraph(gd,gm); initgraph(gd,gm,'c:\tp70\bgi'); as:=readtxt(100,100,'Magassaga? : '); bs:=readtxt(100,130,'Szelessege?: '); kxs:=readtxt(100,160,'Kozeppont x koordinataja?: '); kys:=readtxt(100,190,'Kozeppont y koordinataja?: '); val(as,a,h); hiba:=h<>0; val(bs,b,h); hiba:=hiba or (h<>0); val(kxs,kx,h); hiba:=hiba or (h<>0); val(kys,ky,h); hiba:=hiba or (h<>0); cleardevice; if hiba then outtextxy(100,100,'Rossz adat') else begin setcolor(red); setfillstyle(slashfill,blue); bar(kx-b div 2,ky-a div 2,kx+b div 2, ky + a div 2); rectangle(kx-b div 2,ky-a div 2,kx+b div 2, ky + a div 2); setcolor(white); settextjustify(centertext,centertext); outtextxy(kx,ky,'kozepe'); settextjustify(lefttext,toptext); outtextxy(kx- b div 2+1,ky- a div 2+1,'bal felso'); settextjustify(lefttext,bottomtext); outtextxy(kx- b div 2+1,ky+ a div 2,'bal also'); settextjustify(righttext,toptext); outtextxy(kx+ b div 2,ky- a div 2+1,'jobb felso'); settextjustify(righttext,bottomtext); outtextxy(kx+ b div 2,ky+ a div 2,'jobb also'); end; readkey; closegraph; end.