Изобразить термометр
Категория: Delphi/Pascal
2012-03-15 20:56:12
code: #pascal
uses graph,crt; var gd,gm,y,x:integer; pressedkey:char; label 0,1,2; begin initgraph(gd,gm,'c:\bp\bgi'); ellipse (320, 240, 360, 0, 28,200); y:= 440; outtext('Press up arrow key for moving up/down arrow key for moving down'); outtextxy(1,10,'Press Esc to exit'); 0: pressedkey:=readkey; if pressedkey=chr(27) then halt; if ord(pressedkey)=72 then goto 1; if ord(pressedkey)=80 then goto 2; goto 0; 1: x:= 320; y:= y - 2; IF y < 45 THEN y:= 47; putpixel (x, y, 13); goto 0; 2: putpixel (x, y, 0); x:= 320; y:= y + 2; IF y > 440 THEN y:= 442; putpixel(x, y, 0); goto 0; repeat; until keypressed; closegraph; end.
Поделиться: