NoNameCracksInc icon

Delphi

NoNameCracksInc | PRO | 01/15/14 06:30:54 AM UTC | 0 ⭐ | 7131 👁️ | Never ⏰ | []
Delphi |

1.27 KB

|

None

|

0 👍

/

0 👎

unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;
 
type
  TForm1 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    Image2: TImage;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
  a:array[1..10]of integer;
  d:integer;
  q:real;
  c:integer;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
 randomize;
 Image1.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);
 
 for c:=1 to 10 do begin
 a[c]:=random(100);
 Image1.Canvas.TextOut(0+c*20,10,inttostr(a[c]));
 d:=d+a[c];
end;
 
 q:=d/10;
 Image2.Canvas.TextOut(20,10,floattostr(q));
 d:=0;
 
end;
procedure TForm1.Button2Click(Sender: TObject);
 var p,l,n,q:integer;
 var x,y:integer;
 
begin
 l:=0;
 n:=100;
 
 for p:=1 to 10 do begin
 if l<a[p] then begin
 l:=a[p];
 x:=p;
 end;
 
 for q:=1 to 10 do begin
 if n>a[q] then begin
 n:=a[q];
 y:=q;
 
 end;
 end;
 end;
      Image1.Canvas.TextOut(0+x*20,10,inttostr(n));
      Image1.Canvas.TextOut(0+y*20,10,inttostr(l));
end;
end.

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎