Advertisement
warki10

pis

Jan 19th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.46 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.       c:TCanvas;
  24.      d,f, nr,l,nt,k,y,i:integer;
  25.       r:array [1..5] of string ;
  26.       t:array[1..5] of integer;
  27.       h:array [1..5]  of integer;
  28. implementation
  29.  
  30. {$R *.dfm}
  31.  
  32. procedure TForm1.FormCreate(Sender: TObject);
  33. begin
  34. c:=Image1.Canvas;
  35. c.Brush.Color:=clwhite;
  36. c.Pen.Color:=clblack;
  37. c.Rectangle(0,0,Image1.Width,Image1.Height);
  38. end;
  39.  
  40. procedure TForm1.Button1Click(Sender: TObject);
  41. begin
  42.         randomize;
  43.          k:=100;
  44.         for i:=1 to 5 do begin
  45.         r[i]:=InputBox('rieky','mena','Napis');
  46.         h[i]:=random(50);
  47.         t[i]:=random(30);
  48.         if t[i] < k then begin
  49.                 k:=t[i];
  50.                 f:=i;
  51.                 end;
  52.         if h[i]> l then begin
  53.                 l:=h[i];
  54.                 d:=i;
  55.                 end;
  56.         y:=y+15;
  57.         c.TextOut(20,y,r[i]+ ' '+inttostr(t[i])+ '° '+inttostr(h[i])+'m');
  58.         end;
  59.         y:=y+15;
  60.         c.TextOut(20,y,'najchladnesia rieka je '+' '+r[f]+' '+inttostr(k)+' ° ' + 'a najhlbsia je '+ r[d]+' '+ inttostr(l)+'m ');
  61.  
  62. end;
  63.  
  64. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement