The Delphi Programming Language

Average of 10 numbers program.


Click below to go directly to a specific section:
Description | Source Code | Sample Run | Program Notes

Description

This program demonstrates the visual tool in Delphi.

Source Code

unit Average;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
   edit11.text := floattostrf(((strtofloat(edit1.text) +
              strtofloat(edit2.text) + strtofloat(edit3.text) +
              strtofloat(edit4.text) + strtofloat(edit5.text) +
              strtofloat(edit6.text) + strtofloat(edit7.text) +
              strtofloat(edit8.text) + strtofloat(edit9.text) +
              strtofloat(edit10.text)) / 10), ffgeneral, 10, 4);
end;

end.
Click
here to download the source code.

Sample Run

Average!

Program Notes

This program was tested and run using the trial compiler from Borland.
[Back] [Home]

Last modified: 03:37 PM on 11/09/1996