unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
edt1: TEdit;
edt2: TEdit;
edt3: TEdit;
lbl1: TLabel;
btn1: TButton;
lbl2: TLabel;
lbl3: TLabel;
lbl4: TLabel;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
procedure Klassensprecher;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
stimme1, stimme2, Stimme3, Summe :Integer;
prozent1, prozent2, prozent3 :Real;
s1, s2, s3 :
string;
procedure Tform1.Klassensprecher;
begin
stimme1:=StrToInt(edt1.text);
stimme2:=StrToInt(edt2.text);
stimme3:=StrToInt(edt3.text);
summe:= stimme1+stimme2+stimme3;
prozent1:=stimme1/summe * 100;
prozent2:=stimme2/summe * 100;
prozent3:=Stimme3/summe * 100;
s1:=FloatToStr(prozent1);
s2:=FloatToStr(prozent2);
s3:=FloatToStr(prozent3);
lbl2.Caption:=s1;
lbl3.Caption:=s2;
lbl4.Caption:=s3;
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
begin
Klassensprecher;
end;
end;
end.