- •Структурограммы…………………………………………………………………16
- •Описание структурограмм…..……………………………………………………20
- •Введение
- •Постановка задачи
- •Техническое задание
- •Основание для разработки
- •Назначение разработки
- •Требования к функциональным характеристикам
- •Требования к надёжности
- •Условие эксплуатации
- •Требования к составу и параметру технических средств
- •Требования к информационной и программной совместимости
- •Требования к программной документации
- •Технико-экономические показатели
- •Стадии и этапы разработки
- •Порядок контроля и приемки
- •Пояснительная записка
- •Текст программы
- •Список литературы
-
Текст программы
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
N9: TMenuItem;
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
Uses Unit2,unit5,unit6,unit7;
{$R *.dfm}
procedure TForm1.N2Click(Sender: TObject);
begin
Form2.show;
Form1.Visible:=false;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
Form5.show;
Form1.Visible:=false;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
Form7.show;
Form1.Visible:=false;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
ShowMessage(‘Данная программа используется как пособие для самостоятельного обучения, так и для общего обучения, например в классе. Так же данный продукт может использоваться, как прикладная программа для выполнения операций над клеточными матрицами.‘);
end;
procedure TForm1.N7Click(Sender: TObject);
begin
Form6.show;
Form1.Visible:=false;
end;
procedure TForm1.N9Click(Sender: TObject);
begin
CLOSE
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses unit3,unit1;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
Form3.Show;
Form2.Visible:=false;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
Form1.Show;
Form2.Visible:=false;
end;
end.
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, StdCtrls;
type
TForm3 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Image1: TImage;
Label4: TLabel;
Image2: TImage;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Image3: TImage;
Label10: TLabel;
Label11: TLabel;
Image4: TImage;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Image5: TImage;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Image6: TImage;
Label24: TLabel;
Label25: TLabel;
Image7: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
Uses unit2;
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
Form2.Show;
Form3.Visible:=False;
end;
end.
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, StdCtrls;
type
TForm5 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Image1: TImage;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Image2: TImage;
Image3: TImage;
Label8: TLabel;
Image4: TImage;
Label9: TLabel;
Image5: TImage;
Label10: TLabel;
Image6: TImage;
Label11: TLabel;
Label12: TLabel;
Image7: TImage;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Image8: TImage;
Label18: TLabel;
Image9: TImage;
Label19: TLabel;
Image10: TImage;
Label20: TLabel;
Image11: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
Uses unit1;
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
form1.show;
form5.Visible:=false;
end;
end.
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm6 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Image1: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
Uses unit1;
{$R *.dfm}
procedure TForm6.Button1Click(Sender: TObject);
begin
Form6.Visible:=False;
Form1.Show;
end;
end.
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Grids;
type
TForm7 = class(TForm)
Label1: TLabel;
StringGrid1: TStringGrid;
Label2: TLabel;
Image1: TImage;
Label4: TLabel;
Image2: TImage;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
StringGrid3: TStringGrid;
StringGrid4: TStringGrid;
StringGrid5: TStringGrid;
StringGrid6: TStringGrid;
StringGrid2: TStringGrid;
StringGrid7: TStringGrid;
StringGrid8: TStringGrid;
StringGrid9: TStringGrid;
StringGrid10: TStringGrid;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label3: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
RadioButton1: TRadioButton;
Label15: TLabel;
Image3: TImage;
StringGrid11: TStringGrid;
StringGrid12: TStringGrid;
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
Label22: TLabel;
RadioButton2: TRadioButton;
Image4: TImage;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Button3: TButton;
procedure RadioButton1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
i,j:integer;
implementation
{$R *.dfm}
type
mat=array [1..10,1..10] of integer;
var
S,P,SP11,SP12:mat;
w:integer;
function metod1(n:byte;S,A,B,C,D:TStringGrid):integer;
begin
w:=0;
For i:=0 to n-1 do
For j:=0 to n-1 do {n=4}
If (S.Cells[i,j]=A.Cells[i,j])and
(S.Cells[n,i]=B.Cells[0,i])and
(S.Cells[i,n]=C.Cells[i,0])and
(S.Cells[n,n]=D.Cells[0,0])then w:=w+1
else w:=0;
For i:=0 to n-1 do
For j:=0 to n do
IF (A.Cells[n,j]='') and
(A.Cells[j,n]='') and
(B.Cells[i+1,j]='') and
(B.Cells[0,n]='') and
(C.Cells[j,i+1]='') and
(C.Cells[n,0]='') and
(D.Cells[j,i+1]='') and
(D.Cells[i+1,0]='')then w:=w+1
else w:=0;
metod1:=w
end;
function metod2(n:byte;S,A,B,C,D:TStringGrid):integer;
Begin
w:=0;
For i:=0 to n do
For j:=0 to n do
If (S.Cells[i,j]=A.Cells[i,j])and
(S.Cells[i+2,j]=B.Cells[i,j])and
(S.Cells[i,j+2]=C.Cells[i,j])and
(S.Cells[i+2,j+2]=D.Cells[i,j])
then w:=w+1;{kol=4}
For i:=0 to n do
For j:=0 to n+2 do
IF (A.Cells[j,i+2]='') and
(B.Cells[j,i+2]='') and
(C.Cells[j,i+2]='') and
(D.Cells[j,i+2]='')
then w:=w+1 {kol=8+4}
else w:=0;
For i:=0 to n do
For j:=0 to n do
IF (A.Cells[i+2,j]='') and
(B.Cells[i+2,j]='') and
(C.Cells[i+2,j]='') and
(D.Cells[i+2,j]='')
then w:=w+1 {kol=4+12}
else w:=0;
metod2:=w;
end;
function SUMMA(n:byte):integer;
begin
w:=0;
For i:=1 to n do
For j:=1 to n do
If SP11[i,j]=S[i,j]+P[i,j]
then w:=w+1;
SUMMA:=w
end;
function UMNOG(n:byte):integer;
VAR k:integer;
G:mat;
Begin
W:=0;
For i:=1 to n do
For j:=1 to n do
begin
G[i,j]:=0;
For k:=1 to n do
G[i,j]:=G[i,j]+S[i,k]*P[k,j];
If Sp12[i,j]=G[i,j] then w:=w+1;
end;
UMNOG:=w
end;
procedure TRAN(Q,Z:INTEGER;A:TStringGrid);
BEGIN
A.ColCount:=Q;
A.ROWCOUNT:=Q;
A.Height:=Z;
A.Width:=Z;
END;
procedure TForm7.RadioButton1Click(Sender: TObject);
begin
TRAN(5,100,StringGrid1);TRAN(5,100,StringGrid2);TRAN(5,100,StringGrid3);
TRAN(5,100,StringGrid4);TRAN(5,100,StringGrid5);TRAN(5,100,StringGrid6);
TRAN(5,100,StringGrid7);TRAN(5,100,StringGrid8);TRAN(5,100,StringGrid9);
TRAN(5,100,StringGrid10);TRAN(5,113,StringGrid11);TRAN(5,113,StringGrid12);
For i:=0 to 4 do
For j:=0 to 4 do
begin
StringGrid1.Cells[i,j]:=inttostr(Random(10));
StringGrid2.Cells[i,j]:=inttostr(Random(8));
end;
end;
procedure TForm7.RadioButton2Click(Sender: TObject);
begin
TRAN(4,80,StringGrid1);TRAN(4,80,StringGrid2);TRAN(4,80,StringGrid3);
TRAN(4,80,StringGrid4);TRAN(4,80,StringGrid5);TRAN(4,80,StringGrid6);
TRAN(4,80,StringGrid7);TRAN(4,80,StringGrid8);TRAN(4,80,StringGrid9);
TRAN(4,80,StringGrid10);TRAN(4,93,StringGrid11);TRAN(4,93,StringGrid12);
For i:=0 to 3 do
For j:=0 to 3 do
begin
StringGrid1.Cells[i,j]:=inttostr(Random(8));
StringGrid2.Cells[i,j]:=inttostr(Random(12));
end;
end;
procedure TForm7.Button2Click(Sender: TObject);
Var w1,w2,w3,nom,nom1,nom2,kol,kol1,kol2,sum,pr:integer;
begin
If RadioButton1.Checked
then BEGIN
For i:=1 to 5 do
For j:=1 to 5 do
begin
S[i,j]:=strtoint(StringGrid1.Cells[j-1,i-1]);
P[i,j]:=strtoint(StringGrid2.Cells[j-1,i-1]);
IF StringGrid11.Cells[j-1,i-1]<>'' THEN
SP11[i,j]:=strtoint(StringGrid11.Cells[j-1,i-1])
ELSE SP11[I,J]:=0;
IF StringGrid12.Cells[j-1,i-1]<>'' THEN
SP12[i,j]:=strtoint(StringGrid12.Cells[j-1,i-1])
ELSE SP12[I,J]:=0;
end;
nom1:=metod1(4,StringGrid1,StringGrid3,StringGrid4,StringGrid5,StringGrid6);
{nom1=20+16}
nom2:=metod1(4,StringGrid2,StringGrid7,StringGrid8,StringGrid9,StringGrid10);
{nom2=20+16}
nom:=nom1+nom2;{nom=72}
sum:=SUMMA(5); {sum=25}
pr:=UMNOG(5); {pr=25}
w:=0;
If nom=72 then w1:=1;
if sum=25 then w2:=10;
if pr=25 then w3:=20;
w:=w1+w2+w3;
If w=0 then Edit1.Text:='матрицы не верно разбиты';
If w=31 then Edit1.Text:='все верно';
If w=1 then Edit1.Text:=' не верно выполнены действия';
If w=11 then Edit1.Text:=' не верно выполнено сложение';
If w=21 then Edit1.Text:=' не верно выполнено умножение';
END;
If RadioButton2.Checked
then BEGIN
For i:=1 to 4 do
For j:=1 to 4 do
begin
S[i,j]:=strtoint(StringGrid1.Cells[j-1,i-1]);
P[i,j]:=strtoint(StringGrid2.Cells[j-1,i-1]);
IF StringGrid11.Cells[j-1,i-1]<>'' THEN
SP11[i,j]:=strtoint(StringGrid11.Cells[j-1,i-1])
ELSE SP11[I,J]:=0;
IF StringGrid12.Cells[j-1,i-1]<>'' THEN
SP12[i,j]:=strtoint(StringGrid12.Cells[j-1,i-1])
ELSE SP12[I,J]:=0;
end;
nom1:=metod1(3,StringGrid1,StringGrid3,StringGrid4,StringGrid5,StringGrid6);
{nom1=12+9}
nom2:=metod1(3,StringGrid2,StringGrid7,StringGrid8,StringGrid9,StringGrid10);
{nom2=12+9}
nom:=nom1+nom2; {nom=42}
kol1:=metod2(1,StringGrid1,StringGrid3,StringGrid4,StringGrid5,StringGrid6);
{nom2=4+8+4}
kol2:=metod2(1,StringGrid2,StringGrid7,StringGrid8,StringGrid9,StringGrid10);
{nom1=4+8+4}
kol:=kol1+kol2; {nom=32}
pr:=UMNOG(4); {pr=16}
sum:=SUMMA(4); {sum=16}
w:=0;
If (nom=42)or(kol=32) then w1:=1;
if sum=16 then w2:=10;
if pr=16 then w3:=20;
w:=w1+w2+w3;
If w=0 then Edit1.Text:='матрицы не верно разбиты';
If w=31 then Edit1.Text:='все верно';
If w=1 then Edit1.Text:='не верно выполнены действия';
If w=11 then Edit1.Text:='не верно выполнено сложение';
If w=21 then Edit1.Text:=' не верно выполнено умножение';
END;
end;
procedure TForm7.Button3Click(Sender: TObject);
begin
Edit1.Text:='';
For i:=0 to 4 do
For j:=0 to 4 do
begin
StringGrid3.Cells[i,j]:='';
StringGrid4.Cells[i,j]:='';
StringGrid5.Cells[i,j]:='';
StringGrid6.Cells[i,j]:='';
StringGrid7.Cells[i,j]:='';
StringGrid8.Cells[i,j]:='';
StringGrid9.Cells[i,j]:='';
StringGrid10.Cells[i,j]:='';
StringGrid11.Cells[i,j]:='';
StringGrid12.Cells[i,j]:='';
end;
end;
procedure TForm7.Button1Click(Sender: TObject);
begin
close;
end;
end.