bar2104

Ооп программа

May 4th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.19 KB | None | 0 0
  1. program AppExample;
  2.  uses graph, crt, graphobj;
  3.  type
  4.  Tapplication = object
  5.         procedure init;
  6.         procedure run;
  7.         procedure done;
  8.  end;
  9.  
  10.  
  11.  
  12.  var
  13.         application : Tapplication;
  14.         p : ppoint;
  15.         c : tcircle;
  16.  
  17.  
  18.  
  19.  procedure Tapplication.init;
  20.  var
  21.         d,r,maxx,maxy : integer;
  22.  begin
  23.         d:=detect;
  24.         initGraph(d,r,'C:\BP');
  25.         setbkcolor(white);
  26.         cleardevice;
  27.         maxx:=getmaxx;
  28.         maxy:=getmaxy;
  29.         randomize;
  30.         new(p,init(random(maxx),random(maxy),red));
  31.         p^.show;
  32.         c.Init(random(maxx-40)+20,random(maxy-40)+20,20,blue);
  33.         c.show
  34.  end;
  35.  
  36.  
  37.  
  38.  procedure tapplication.run;
  39.  var
  40.         maxx, maxy : integer;
  41.  begin
  42.         maxx := getmaxx;
  43.         maxy := getmaxy;
  44.         repeat
  45.                 p^.moveto(random(maxx),random(maxy));
  46.                 c.moveto(random(maxx-40)+20,random(maxy-40)+20);
  47.                 delay(500)
  48.         until keypressed
  49.  end;
  50.  
  51.  
  52.  
  53.  
  54.  procedure tapplication.done;
  55.  begin
  56.         dispose(p,done);
  57.         c.done;
  58.         closegraph
  59.  end;
  60.  
  61.  
  62.  
  63.  begin
  64.         application.init;
  65.         application.run;
  66.         application.done
  67.  end.
Add Comment
Please, Sign In to add comment