
Stian Søiland, IT 111, øvingsgruppe 15 (stud.ass. Kari Alvheim)

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
santall: TEdit;
smin: TEdit;
smaks: TEdit;
ssum: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var tall,antall,maks,min,sum : integer;
stall : string;
fortsett : boolean;
begin
fortsett := true;
antall := 0;
sum := 0;
maks := 0;
min := 0;
santall.clear;
smin.clear;
smaks.clear;
ssum.clear;
while fortsett do
begin
stall := InputBox('Tallregistrering','Skriv inn et heltallet, tomt felt avslutter.','');
if stall <> '' then
begin
tall := StrToInt(stall);
if antall = 0 then
begin
maks := tall;
min := tall;
end;
antall := antall + 1;
sum := sum + tall;
if tall > maks then
maks := tall
else
if tall < min then
min := tall;
end
else
fortsett := false;
end;
santall.text := IntToStr(antall);
smin.text := IntToStr(min);
smaks.text := IntToStr(maks);
ssum.text := IntToStr(sum);
end;
end.