Advertisement
warki10

look at me when i tear your face off

Jan 12th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.57 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, ExtCtrls, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Image1: TImage;
  12.     Button1: TButton;
  13.     procedure FormCreate(Sender: TObject);
  14.     procedure Button1Click(Sender: TObject);
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. var
  22.   Form1: TForm1;
  23.   y,i,p,max,min,k:integer;
  24.         c:Tcanvas;
  25.         m:array [1..5] of string;
  26.         v:array [1..100] of integer;
  27. implementation
  28.  
  29. {$R *.dfm}
  30.  
  31. procedure TForm1.FormCreate(Sender: TObject);
  32. begin
  33. c:=Image1.Canvas;
  34. c.Brush.Color:=clwhite;
  35. Image1.Canvas.Pen.Color:=clblack;
  36. Image1.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);
  37.  
  38. end;
  39.  
  40. procedure TForm1.Button1Click(Sender: TObject);
  41. begin
  42.         randomize;
  43.         min:=100000;
  44.         for i:=1 to 5 do begin
  45.             m[i]:=InputBox('mena','zadaj meno','') ;
  46.             v[i]:=random (100);
  47.             if v[i]>max then begin
  48.                 p:=i;
  49.                 max:=v[i];
  50.                 end;
  51.             if v[i]<min then begin
  52.                 k:=i;
  53.                 min:=v[i];
  54.                 end;
  55.         end;
  56.                 for i:=1 to 5 do begin
  57.                 y:=y+20;
  58.                 c.TextOut(10,y,m[i]+'-'+inttostr(v[i])+'rokov');
  59.                 end;
  60.                 y:=y+50;
  61.                 c.TextOut(10,y,'najstrarsi ma '+inttostr(max)+' rokov '+m[p]);
  62.                 y:=y+20;
  63.                 c.TextOut(10,y,'najmladsi ma '+inttostr(min)+' vola sa '+m[k]);
  64. end;
  65.  
  66. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement