,,,
Borland Delphi 7.0. , . ( ) Delphi 7.0. .
, - Excel.
, , , .
, , , .
1. Delphi
, , , , , StringGrid, CheckBox, RadioButton, Windows.
Unit1, Unit2, Unit3, Uni4, UnitCl.
Unit1
Unit2
Unit3
Unit4
. (UnitCl) :
procedure RowC (AStringGrid:TStringGrid);
procedure XDGr (AStringGrid:TStringGrid);
procedure WTKGr (AStringGrid:TStringGrid);
procedure BANGr (AStringGrid:TStringGrid);
procedure Clear (AStringGrid:TStringGrid);
procedure WriteXD (AStringGrid:TStringGrid);
procedure WriteWTK (AStringGrid:TStringGrid);
procedure WriteBAN (AStringGrid:TStringGrid);
procedure ReadXD (AStringGrid:TStringGrid);
procedure ReadWTK (AStringGrid:TStringGrid);
procedure ReadBAN (AStringGrid:TStringGrid);
procedure BANK (AStringGrid:TStringGrid);
procedure WTK (AStringGrid:TStringGrid);
procedure XD (AStringGrid:TStringGrid);
procedure XDShow;
procedure WTKShow;
procedure BANKShow;
procedure null;
procedure FindXD (AEdit1:TEdit; AStringGrid:TStringGrid);
procedure FindWTK (AEdit1:TEdit; AStringGrid:TStringGrid);
procedure FindBANK (AEdit1:TEdit; AStringGrid:TStringGrid);
procedure MoySort1 (AStringGrid:TStringGrid); . 1
procedure MoySort2 (AStringGrid:TStringGrid); . 2
procedure MoySort5 (AStringGrid:TStringGrid); . 5
procedure MoySort7 (AStringGrid:TStringGrid); . 7
2.
. , 8 , , 56 . Next . , , . , .
type
TPSpisXD=^TSpisXD;
TSpisXD = record
numb:string[20]; //
datzak:string[20]; //
datzav:string[20]; //
temadog:string[40]; //
namorg:string[20]; //
priznak:string[15]; //
stoimost:string[10]; // .
next: TPSpisXD; //
end;
. , 8 , , 80 .
type
TPSpisWTK=^TSpisWTK;
TSpisWTK=record
fam:string[20]; //
name:string[20]; //
otc:string[20]; //
god:string[40]; //
kod:string[20]; //
prznak:string[15]; //
zarplat:string[20]; //
adres:string[20]; //
banknum:string[20]; //
rasschet:string[40]; // /
next: TPSpisWTK;
end;
. , 8 , , 40 .
type
TPSpisBAN=^TSpisBAN;
TSpisBAN=record
numotd:string[20]; //
gorod:string[20]; //
adress:string[20]; //
naim:string[40]; //
kod:string[20]; //
next: TPSpisBAN;
end;
, .
var
head1: TPSpisXD; // () XD
head2: TPSpisWTK; // WTK
head3: TPSpisBAN; // BAN
, .
kp:TKp;
i, Row, CP: Integer;
SList: TStringList;
n: integer; // (- )
st: string; //
Fil: string;
FirstStr: string;
3.
, .
type
TPSpisXD=^TSpisXD;
TSpisXD = record
numb:string[20]; //
datzak:string[20]; //
datzav:string[20]; //
temadog:string[40]; //
namorg:string[20]; //
priznak:string[15]; //
stoimost:string[10]; // .
next: TPSpisXD; //
end;
, (next) .. .
. . 2- , . (- , ) .
4.
.
procedure TKp. MoySort1 (AStringGrid:TStringGrid);
//
var
node: TPSpisXD; //
curr: TPSpisXD; //
pre: TPSpisXD; // , curr,
i:integer; // counter
begin
Kp.null;
i:=1;
//repeat
while (i<11) do
begin
new(node);
node^.numb:=AStringGrid. Cells [1, i];
node^.datzak:=AStringGrid. Cells [2, i];
node^.datzav:=AStringGrid. Cells [3, i];
node^.temadog:=AStringGrid. Cells [4, i];
node^.namorg:=AStringGrid. Cells [5, i];
node^.priznak:=AStringGrid. Cells [6, i];
node^.stoimost:=AStringGrid. Cells [7, i];
//
curr:=head1;
pre:=NIL;
while (curr <> NIL) and (node.numb > curr^.numb) do
begin
//
pre:= curr;
curr:=curr^.next; //
end;
if pre = NIL
then
begin
//
node^.next:=head1;
head1:=node;
end
else
begin
// pre, curr
node^.next:=pre^.next;
pre^.next:=node;
end;
i:=i+1;
end;
Kp.XDShow;
end;
procedure TKp.XDShow;
var
curr: TPSpisXD; //
//n:integer; // (- )
// st:string; //
begin
n:=0;
st:='';
curr:=head1;
while curr <> NIL do
begin
n:=n+1;
st:=st+curr^.numb+' '+curr^.datzak+' '+curr^.datzav+' '+curr^.temadog+' '+curr^.namorg+' '+curr^.priznak+' '+curr^.stoimost+#13;
curr:=curr^.next;
end;
if n <> 0
then ShowMessage (':'+#13+#13+st)
else ShowMessage (' .');
end;
procedure TKp.XD (AStringGrid:TStringGrid);
var
node: TPSpisXD; //
curr: TPSpisXD; //
pre: TPSpisXD; // , curr,
i:integer; // counter
// n:integer; // (- )
// st:string; //
begin
i:=1;
//repeat
while (i<11) do
begin
new(node);
node^.numb:={Edit1. Text;} AStringGrid. Cells [1, i];
node^.datzak:= {Edit2. Text;} AStringGrid. Cells [2, i];
node^.datzav:= {Edit3. Text;} AStringGrid. Cells [3, i];
node^.temadog:= {Edit4. Text;} AStringGrid. Cells [4, i];
node^.namorg:= {Edit5. Text;} AStringGrid. Cells [5, i];
node^.priznak:= {Edit6. Text;} AStringGrid. Cells [6, i];
node^.stoimost:= {Edit7. Text;} AStringGrid. Cells [7, i];
//
curr:=head1;
pre:=NIL;
while (curr <> NIL) and (node.numb > curr^.numb) do
begin
//
pre:= curr;
curr:=curr^.next; //
end;
if pre = NIL
then
begin
//
node^.next:=head1;
head1:=node;
end
else
begin
// pre, curr
node^.next:=pre^.next;
pre^.next:=node;
end;
i:=i+1;
//until (i<11);
end;
ShowMessage (' !');
end;
procedure TKp. FindXD (AEdit1:TEdit; AStringGrid:TStringGrid);
var
curr:TPSpisXD; // ,
pre: TPSpisXD; //
found:boolean; // TRUE ,
// st:string;
// a:integer;
begin
if head1 = NIL then
begin
MessageDlg (' !', mtError, [mbOk], 0);
Exit;
end;
curr:=head1; //
pre:=NIL; //
found:=FALSE;
//
=======
while (curr <> NIL) and (not found) do
begin
if (curr^.numb = {'13'} AEdit1. Text) xor (curr^.datzak = AEdit1. Text)
xor (curr^.datzav = AEdit1. Text) xor (curr^.temadog = AEdit1. Text)
xor (curr^.namorg = AEdit1. Text) xor (curr^.priznak = AEdit1. Text)
xor (curr^.stoimost = AEdit1. Text)
then found:=TRUE //
else //
begin
pre:=curr;
curr:=curr^.next;
end;
=======
end;
if found then
begin
Kp. Clear(AStringGrid);
Kp.XDGr(AStringGrid);
Kp. RowC(AStringGrid);
ShowMessage (' ');
AStringGrid. Cells [1,1]:=''+curr^.numb;
AStringGrid. Cells [2,1]:=''+curr^.datzak;
AStringGrid. Cells [3,1]:=''+curr^.datzav;
AStringGrid. Cells [4,1]:=''+curr^.temadog;
AStringGrid. Cells [5,1]:=''+curr^.namorg;
AStringGrid. Cells [6,1]:=''+curr^.priznak;
AStringGrid. Cells [7,1]:=''+curr^.stoimost;
end
else //
MessageDlg (' ', mtError, [mbOk], 0);
end;
5.
project1.exe. , .
, , , , .
.
, DEL, .
3 , , .
, . Delphi.
, , , , , .
1. .. Delphi. - : ϻ, 2003. - 506 .
2. . . - : , 2001. 352 .
3. .. Java. / .. , . . .: , 2003. 671 .
4. .., .., .., . : . .: , 2009. 1296 .
5. .. . .: . , 2008. 765 .
6. . . 1-4: / / / . - .: , 2003. - 672 .
Unit1.pas
// ==============
// Created by Kamenev A.I.
// gr 417318
// Minsk 2010 MIDO BNTU
// ===================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, XPMan, UnitCl, Menus, Unit2;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
Button2: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
XPManifest1: TXPManifest;
Button7: TButton;
Bevel1: TBevel;
CheckBox1: TCheckBox;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
Bevel2: TBevel;
Button3: TButton;
Button8: TButton;
FindDialog1: TFindDialog;
procedure Button6Click (Sender: TObject);
procedure FormCreate (Sender: TObject);
procedure RadioButton1Click (Sender: TObject);
procedure RadioButton2Click (Sender: TObject);
procedure RadioButton3Click (Sender: TObject);
procedure CheckBox1Click (Sender: TObject);
procedure Button4Click (Sender: TObject);
procedure Button1Click (Sender: TObject);
procedure N2Click (Sender: TObject);
procedure N10Click (Sender: TObject);
procedure N8Click (Sender: TObject);
procedure Button5Click (Sender: TObject);
procedure Button2Click (Sender: TObject);
procedure N3Click (Sender: TObject);
procedure Button7Click (Sender: TObject);
procedure N4Click (Sender: TObject);
procedure FormActivate (Sender: TObject);
procedure Button3Click (Sender: TObject);
procedure Button8Click (Sender: TObject);
procedure N6Click (Sender: TObject);
procedure N7Click (Sender: TObject);
private
{Private declarations}
public
{Public declarations}
end;
var
Form1: TForm1;
implementation
uses Unit3, Unit4;
{$R *.dfm}
// ===================
procedure TForm1. Button6Click (Sender: TObject);
begin
// :
Halt;
end;
// ===================
procedure TForm1. FormCreate (Sender: TObject);
begin
//
CheckBox1Click(Sender);
Kp. ReadXD(StringGrid1);
Kp. Free;
end;
// ===================
procedure TForm1. RadioButton1Click (Sender: TObject);
begin
// XD
FormCreate(Sender);
Button8Click(Sender);
end;
// ===================
procedure TForm1. RadioButton2Click (Sender: TObject);
begin
// WTK
Kp. Clear(StringGrid1); //
// WTK
Kp.WTKGr(StringGrid1);
Kp. RowC(StringGrid1);
Kp. ReadWTK(StringGrid1);
Kp. Free;
Button8Click(Sender);
end;
procedure TForm1. RadioButton3Click (Sender: TObject);
begin
// BANK
Kp. Clear(StringGrid1); //
// Bank
Kp.BANGr(StringGrid1);
Kp. RowC(StringGrid1);
Kp. ReadBAN(StringGrid1);
Kp. Free;
Button8Click(Sender);
end;
// ===================
procedure TForm1. CheckBox1Click (Sender: TObject);
begin
//
If CheckBox1. Checked Then
StringGrid1. Options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing]
else
StringGrid1. Options:=[goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing]
end;
// ===================
procedure TForm1. Button4Click (Sender: TObject);
begin
//
Form3. Top:=Trunc (Form1. Top + Form1. Height/2 Form3. Height/2);
Form3. Left:=Trunc (Form1. Left +Form1. Width/2 Form3. Width/2);
Form3. ShowModal;
end;
// ===================
procedure TForm1. Button1Click (Sender: TObject);
begin
//
Kp. Clear(StringGrid1); //
If RadioButton1. Checked Then //
begin //
Kp.XDGr(StringGrid1); //
Kp. RowC(StringGrid1);
end
else if RadioButton2. Checked Then
begin
Kp.WTKGr(StringGrid1);
Kp. RowC(StringGrid1);
end
else if RadioButton3. Checked Then
begin
Kp.BANGr(StringGrid1);
Kp. RowC(StringGrid1);
end;
Kp. Free;
end;
// =
=====
procedure TForm1.N2Click (Sender: TObject);
begin
ShowMessage
(' '+#13+#13+' .. 417 318 / 10 '
+#13+' 2010 .'+#13+#13+' .');
end;
// ===================
procedure TForm1.N10Click (Sender: TObject);
begin
//
Button6Click(Sender);
end;
// ===================
procedure TForm1.N8Click (Sender: TObject);
begin
//
Button1Click(Sender);
end;
// ===================
procedure TForm1. Button5Click (Sender: TObject);
// .
begin
Form4. Top:=Trunc (Form1. Top + Form1. Height/2 Form4. Height/2);
Form4. Left:=Trunc (Form1. Left +Form1. Width/2 Form4. Width/2);
Form4. ShowModal;
end;
// ===================
procedure TForm1. Button2Click (Sender: TObject);
//
begin
If RadioButton1. Checked Then
Kp. WriteXD(StringGrid1)
else if RadioButton2. Checked Then
Kp. WriteWTK(StringGrid1)
else if RadioButton3. Checked Then
Kp. WriteBAN(StringGrid1);
ShowMessage (' !');
Kp. Free;
end;
// ===================
procedure TForm1.N3Click (Sender: TObject);
begin
//
Button2Click(Sender);
end;
// ===================
//
procedure TForm1. Button7Click (Sender: TObject);
begin
Form2. Top:=Trunc (Form1. Top + Form1. Height/2 Form2. Height/2);
Form2. Left:=Trunc (Form1. Left +Form1. Width/2 Form2. Width/2);
Form2. ShowModal;
//
// cells'
// StringGrid1
end;
// ===================
procedure TForm1.N4Click (Sender: TObject);
begin
//
Button7Click(Sender);
end;
// ===================
procedure TForm1. FormActivate (Sender: TObject);
begin
// 1 2 3
Kp.null;
end;
// ===================
procedure TForm1. Button3Click (Sender: TObject);
begin
//
If RadioButton1. Checked Then
Kp.XDShow
else if RadioButton2. Checked Then
Kp.WTKShow
else if RadioButton3. Checked Then
Kp.BANKShow;
Kp. Free;
end;
// ===================
procedure TForm1. Button8Click (Sender: TObject);
begin
FormActivate(Sender);
// StrigGrid
If RadioButton1. Checked Then
Kp.XD(StringGrid1)
else if RadioButton2. Checked Then
Kp.WTK(StringGrid1)
else if RadioButton3. Checked Then
Kp.BANK(StringGrid1);
Kp. Free;
end;
// ===================
procedure TForm1.N6Click (Sender: TObject);
begin
// --
Button4Click(Sender);
end;
// ===================
procedure TForm1.N7Click (Sender: TObject);
begin
// --
Button5Click(Sender);
end;
// ===================
end.
UnitCl.pas
// ************
// Created by Kamenev A.I. 417 318 10 var.
// Minsk MIDO BNTU.
//
// ************
unit UnitCl;
interface
uses
SysUtils, Forms, StdCtrls, Grids, Classes, Dialogs;
type
TKp = class (TObject)
Private
{Private data}
Public
procedure RowC (AStringGrid:TStringGrid);
procedure XDGr (AStringGrid:TStringGrid);
procedure WTKGr (AStringGrid:TStringGrid);
procedure BANGr (AStringGrid:TStringGrid);
procedure Clear (AStringGrid:TStringGrid);
procedure WriteXD (AStringGrid:TStringGrid);
procedure WriteWTK (AStringGrid:TStringGrid);
procedure WriteBAN (AStringGrid:TStringGrid);
procedure ReadXD (AStringGrid:TStringGrid);
procedure ReadWTK (AStringGrid:TStringGrid);
procedure ReadBAN (AStringGrid:TStringGrid);
procedure BANK (AStringGrid:TStringGrid);
procedure WTK (AStringGrid:TStringGrid);
procedure XD (AStringGrid:TStringGrid);
procedure XDShow;
procedure WTKShow;
procedure BANKShow;
procedure null;
procedure FindXD (AEdit1:TEdit; AStringGrid:TStringGrid);
procedure FindWTK (AEdit1:TEdit; AStringGrid:TStringGrid);
procedure FindBANK (AEdit1:TEdit; AStringGrid:TStringGrid);
procedure MoySort1 (AStringGrid:TStringGrid);
procedure MoySort2 (AStringGrid:TStringGrid);
procedure MoySort5 (AStringGrid:TStringGrid);
procedure MoySort7 (AStringGrid:TStringGrid);
end;
// **********
var
kp:TKp;
i, Row, CP: Integer;
SList: TStringList;
n: integer; // (- )
st: string; //
Fil: string;
FirstStr: string;
// **********
implementation
type
TPSpisXD=^TSpisXD;
TSpisXD = record
numb:string[20]; //
datzak:string[20]; //
datzav:string[20]; //
temadog:string[40]; //
namorg:string[20]; //
priznak:string[15]; //
stoimost:string[10]; // .
next: TPSpisXD; //
end;
type
TPSpisWTK=^TSpisWTK;
TSpisWTK=record
fam:string[20]; //
name:string[20]; //
otc:string[20]; //
god:string[40]; //
kod:string[20]; //
prznak:string[15]; //
zarplat:string[20]; //
adres:string[20]; //
banknum:string[20]; //
rasschet:string[40]; // /
next: TPSpisWTK;
end;
type
TPSpisBAN=^TSpisBAN;
TSpisBAN=record
numotd:string[20]; //
gorod:string[20]; //
adress:string[20]; //
naim:string[40]; //
kod:string[20]; //
next: TPSpisBAN;
end;
var
head1: TPSpisXD; // () XD
head2: TPSpisWTK; // WTK
head3: TPSpisBAN; // BAN
// ===================
procedure TKp.null;
//
begin
head1:=NIL;
head2:=NIL;
head3:=NIL;
end;
// ===================
procedure TKp. MoySort1 (AStringGrid:TStringGrid);
//
var
node: TPSpisXD; //
curr: TPSpisXD; //
pre: TPSpisXD; // , curr,
i:integer; // counter
begin
Kp.null;
i:=1;
//repeat
while (i<11) do
begin
new(node);
node^.numb:=AStringGrid. Cells [1, i];
node^.datzak:=AStringGrid. Cells [2, i];
node^.datzav:=AStringGrid. Cells [3, i];
node^.temadog:=AStringGrid. Cells [4, i];
node^.namorg:=AStringGrid. Cells [5, i];
node^.priznak:=AStringGrid. Cells [6, i];
node^.stoimost:=AStringGrid. Cells [7, i];
//
curr:=head1;
pre:=NIL;
while (curr <> NIL) and (node.numb > curr^.numb) do
begin
//
pre:= curr;
curr:=curr^.next; //
end;
if pre = NIL
then
begin
//
node^.next:=head1;
head1:=node;
end
else
begin
// pre, curr
node^.next:=pre^.next;
pre^.next:=node;
end;
i:=i+1;
end;
Kp.XDShow;
end;
// ===================
procedure TKp. MoySort2 (AStringGrid:TStringGrid);
//
var
node: TPSpisXD; //
curr: TPSpisXD; //
pre: TPSpisXD; // , curr,
i:integer; // counter
begin
Kp.null;
i:=1;
//repeat
while (i<11) do
begin
new(node);
node^.numb:={Edit1. Text;} AStringGrid. Cells [1, i];
node^.datzak:= {Edit2. Text;} AStringGrid. Cells [2, i];
node^.datzav:= {Edit3. Text;} AStringGrid. Cells [3, i];
node^.temadog:= {Edit4. Text;} AStringGrid. Cells [4, i];
node^.namorg:= {Edit5. Text;} AStringGrid. Cells [5, i];
node^.priznak:= {Edit6. Text;} AStringGrid. Cells [6, i];
node^.stoimost:= {Edit7. Text;} AStringGrid. Cells [7, i];
curr:=head1;
pre:=NIL;
while (curr <> NIL) and (node.datzak > curr^.datzak) do
begin
//
pre:= curr;
curr:=curr^.next; //
end;
if pre = NIL
then
begin
//
node^.next:=head1;
head1:=node;
end
else
begin
// pre, curr
node^.next:=pre^.next;
pre^.next:=node;
end;
i:=i+1;
end;
Kp.XDShow;
end;
// ===================
procedure TKp. MoySort5 (AStringGrid:TStringGrid);
//
var
node: TPSpisXD; //
curr: TPSpisXD; //
pre: TPSpisXD; // , curr,
i:integer; // counter
// n:integer; // (- )
// st:string; //
begin
Kp.null;
i:=1;
//repeat
while (i<11) do
begin
new(node);
node^.numb:={Edit1. Text;} AStringGrid. Cells [1, i];
node^.datzak:= {Edit2. Text;} AStringGrid. Cells [2, i];
node^.datzav:= {Edit3. Text;} AStringGrid. Cells [3, i];
node^.temadog:= {Edit4. Text;} AStringGrid. Cells [4, i];
node^.namorg:= {Edit5. Text;} AStringGrid. Cells [5, i];
node^.priznak:= {Edit6. Text;} AStringGrid. Cells [6, i];
node^.stoimost:= {Edit7. Text;} AStringGrid. Cells [7, i];
//
curr:=head1;
pre:=NIL;
while (curr <> NIL) and (node.namorg > curr^.namorg) do
begin
//
pre:= curr;
curr:=curr^.next; //
end;
if pre = NIL
then
begin
//
node^.next:=head1;
head1:=node;
end
else
begin
// pre, curr
node^.next:=pre^.next;
pre^.next:=node;
end;
i:=i+1;
//until (i<11);
end;
Kp.XDShow;
end;
// ===================
procedure TKp. MoySort7 (AStringGrid:TStringGrid);
// 7
var
node: TPSpisXD; //
curr: TPSpisXD; //
pre: TPSpisXD; // , curr,
i:integer; // counter
// n:integer; // (- )
// st:string; //
begin
Kp.null;
i:=1;
//repeat
while (i<11) do
begin
new(node);
node^.numb:={Edit1. Text;} AStringGrid. Cells [1, i];
node^.datzak:= {Edit2. Text;} AStringGrid. Cells [2, i];
node^.datzav:= {Edit3. Text;} AStringGrid. Cells [3, i];
node^.temadog:= {Edit4. Text;} AStringGrid. Cells [4, i];
node^.namorg:= {Edit5. Text;} AStringGrid. Cells [5, i];
node^.priznak:= {Edit6. Text;} AStringGrid. Cells [6, i];
node^.stoimost:= {Edit7. Text;} AStringGrid. Cells [7, i];
//
curr:=head1;
pre:=NIL;
while (curr <> NIL) and (node.stoimost > curr^.stoimost) do
begin
//
pre:= curr;
curr:=curr^.next; //
end;
if pre = NIL
then
begin
//
node^.next:=head1;
head1:=node;
end
else
begin
// pre, curr
node^.next:=pre^.next;
pre^.next:=node;
end;
i:=i+1;
//until (i<11);
end;
Kp.XDShow;
end;
// ===================
procedure TKp.WTKShow;
var
end
else if Form4. RadioButton4. Checked Then
begin
Kp. MoySort7 (Form1. StringGrid1);
end;
Kp. Free;
end;
procedure TForm4. Button2Click (Sender: TObject);
begin
Form4. Close;
end;
end.
: 2010 Bor
Copyright (c) 2024 Stud-Baza.ru , , , .