Введение в технологию программирования. Ч.1. Среда объектно-ориентированного программирования Delphi. Коржов Е.Н - 27 стр.

UptoLike

Составители: 

27
ɇɚɡɧɚɱɟɧɢɟ: ɉɨɞɫɱɟɬ ɫɪɟɞɧɟɝɨ ɛɚɥɥɚ ɤɚɠɞɨɝɨ ɫɬɭɞɟɧɬɚ
ȼɯɨɞɧɵɟ ɞɚɧɧɵɟ: Ɉɰɟɧɤɢ ɤɚɠɞɨɝɨ ɫɬɭɞɟɧɬɚ
ȼɵɯɨɞɧɵɟ ɞɚɧɧɵɟ: ɋɪɟɞɧɢɟ ɨɰɟɧɤɢ ɫɬɭɞɟɧɬɨɜ
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Grids;
type
TForm1 = class(TForm)
Panel1: TPanel;
StringGrid1: TStringGrid;
BitBtn1: TBitBtn;
procedure FormActivate(Sender: TObject);
procedure StringGrid1SetEditText(Sender: TObject; ACol,
ARow: Integer; const Value:
String);
private
{ Private declarations }
public
{ Public declarations }
end;
const
nn = 10; //Ɇɚɤɫɢɦɚɥɶɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɭɱɟɧɢɤɨɜ = 10
mm = 5; //Ɇɚɤɫɢɦɚɥɶɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɷɤɡɚɦɟɧɨɜ = 5
var
Form1: TForm1;
a : array [1..nn, 1..mm] of Real; //a - ɦɚɫɫɢɜ ɨɰɟɧɨɤ
ss : array [1..nn] of Real; //ss - ɦɚɫɫɢɜ ɞɥɹ ɫɪɟɞɧɟɝɨ ɛɚɥɥɚ ɭɱɟɧɢɤɨɜ
implementation
{$R *.dfm}
procedure TForm1.FormActivate(Sender: TObject);
var
i : integer;
begin
stringGrid1.Cells[0,0] := 'ɇɨɦɟɪ ɫɬɭɞɟɧɬɚ';
for i:=1 to 10 do
stringGrid1.Cells[0,i]:='ʋ '+IntToStr(i);
for i:=1 to 4 do
stringGrid1.Cells[i,0]:='Ɉɰɟɧɤɚ ʋ'+IntToStr(i);
stringGrid1.Cells[5,0]:='ɋɪɟɞɧɹɹ ɨɰɟɧɤɚ'
end; { TForm1.FormActivate }
procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol, ARow:
  ɇɚɡɧɚɱɟɧɢɟ: ɉɨɞɫɱɟɬ ɫɪɟɞɧɟɝɨ ɛɚɥɥɚ ɤɚɠɞɨɝɨ ɫɬɭɞɟɧɬɚ
  ȼɯɨɞɧɵɟ ɞɚɧɧɵɟ: Ɉɰɟɧɤɢ ɤɚɠɞɨɝɨ ɫɬɭɞɟɧɬɚ
  ȼɵɯɨɞɧɵɟ ɞɚɧɧɵɟ: ɋɪɟɞɧɢɟ ɨɰɟɧɤɢ ɫɬɭɞɟɧɬɨɜ
}
interface
   uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
        Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Grids;
   type
     TForm1 = class(TForm)
                    Panel1: TPanel;
                    StringGrid1: TStringGrid;
                    BitBtn1: TBitBtn;
                    procedure FormActivate(Sender: TObject);
                    procedure StringGrid1SetEditText(Sender: TObject; ACol,
                                               ARow: Integer; const Value:
                                               String);
                    private
                        { Private declarations }
                    public
                        { Public declarations }
                 end;
const
   nn = 10; //Ɇɚɤɫɢɦɚɥɶɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɭɱɟɧɢɤɨɜ = 10
   mm = 5; //Ɇɚɤɫɢɦɚɥɶɧɨɟ ɤɨɥɢɱɟɫɬɜɨ ɷɤɡɚɦɟɧɨɜ = 5
var
   Form1: TForm1;
   a : array [1..nn, 1..mm] of Real; //a - ɦɚɫɫɢɜ ɨɰɟɧɨɤ
   ss : array [1..nn] of Real; //ss - ɦɚɫɫɢɜ ɞɥɹ ɫɪɟɞɧɟɝɨ ɛɚɥɥɚ ɭɱɟɧɢɤɨɜ
implementation
   {$R *.dfm}
procedure TForm1.FormActivate(Sender: TObject);
var
   i : integer;
begin
   stringGrid1.Cells[0,0] := 'ɇɨɦɟɪ ɫɬɭɞɟɧɬɚ';
   for i:=1 to 10 do
        stringGrid1.Cells[0,i]:='ʋ '+IntToStr(i);
   for i:=1 to 4 do
        stringGrid1.Cells[i,0]:='Ɉɰɟɧɤɚ ʋ'+IntToStr(i);
   stringGrid1.Cells[5,0]:='ɋɪɟɞɧɹɹ ɨɰɟɧɤɚ'
end; { TForm1.FormActivate }
procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol, ARow:
                                  27