Var i,j,cod:integer;
A:array[1..4,1..4] of Real;
S:real; s1:String;
begin
For i:=1 to 4 do
For j:=1 to 4 do
Val(StringGrid1.cells[i-1,j-1],a[i,j],cod);
S:=0;
For i:=1 to 4 do
For j:=1 to 4 do
s:=s+a[i,j];
Str(s:7:2,s1);
Memo1.Clear;
Memo1.Lines.add('Summa ='+s1);
s:=s/4/4;
Str(s:7:2,s1);
Memo1.Lines.add('Ortacha='+s1);
end;
4.Tuzilgan loyiha (proekt) ya’ni Project1 va Unit1 standart modul nomlarini mos nomlar bilan almashtirib saqlaymiz.
5.YAngi nom bilan saqlangan proekt, ya’ni ILOVA F9 tugmachasini bosish bilan ishga tushuriladi.
ILOVA ishga tushirilganda uning quyidagi ko‘rinishi ekranda namayon bo‘ladi.
Tashkil qilingan modulning to‘liq ko‘rinishini keltiramiz.
unit j1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
Label1: TLabel;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Var i,j,cod:integer;
A:array[1..4,1..4] of Real;
S:real; s1:String;
begin
For i:=1 to 4 do For j:=1 to 4 do
Val(StringGrid1.cells[i-1,j-1],a[i,j],cod);
S:=0;
Do'stlaringiz bilan baham: |