.


:




:

































 

 

 

 


If not(St[i] in a) then begin




Include(a,St[i]); Inc(m);

end;

Result:=m;

end;

 

Function FWrd(st: string): string;

var n,i,nst: integer;

sl,srez: string;

Begin

Result:=''; srez:=''; n:=Length(st);

if n=0 then exit;

st:=st+' '; n:=n+1; sl:='';

for i:=1 to n do

if st[i]<>' ' then sl:=sl+st[i]

Else

If sl<>'' then begin

srez:=srez+' '+sl+'-'+IntTostr(Krz(sl)); sl:='';

end;

Result:=srez;

end; // FWrd

 

procedure TForm1.FormCreate(Sender: TObject);

Begin

Edit1.Clear; Edit2.Clear;

end;

 

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);

Begin

if Key = #13 then Edit2.Text:=FWrd(Edit1.Text);

end;

End.

7.6.

. TEdit. Enter. .

1. , , . .

2. , . , .

3. , . , .

4. , . , .

5. , , . .

6. , , . .

7. , . . .

8. , . . .

9. , . . .

10. , , . .

11. , . ,

12. , , . , k - ( k - , ), .

13. , , . , k - ( k - , , k -).

14. , , . .

15. , , . .


 

8.

: TOpenDialog TSaveDialog. . .

8.1.

, , . , :

Type TStudent = record //

Fio:string[30]; // ...

Group:integer; // .

Ocn: array [1..3] of integer; //

end;

Var Student: TStudent; //

, , :

Student.Fio:= ..; //

Student.Group:=720603;

with:

With Student do begin

Fio:= ..;

Group:=720603;

end;

8.2.

. Object Pascal : , .

, . DELPHI ( pas). : Var F: TextFile;.

, . . , , . : Var F: TStudent;.

, . : Var F: File;.

:

...

AssignFile (Fl, Filenam1.txt); //

AssignFile (Fw, Filenam2.txt); //

Rewrite (Fl); // Fl

Reset (Fw);) // Fw

...

Write (Fl, Stud); // Fl

Read (Fw, Stud); // Fw

...

CloseFile (Fl); // Fl

CloseFile (Fw); // Fw

8.3.

AssignFile(var F; FileName: string) - F FileName.

Reset(var F[: File; RecSize: word] ) - . RecSize .

Rewrite(var F[: File; RecSize: word]) - .

Append(var F: TextFile ) - .

Read(F,v1[,v2,vn]) - .

Write(F,v1[,v2,vn]) - .

CloseFile(F) - .

Rename(var F; NewName: string ) - .

Erase(var F) - .

Seek(var F; NumRec: Longint) - NumRec.

SetTextBuf(var F: TextFile; var Buf[;Size: word]) - - Size.

Flush(var F: TextFile ) - -.

Truncate(var F) - , .

IoResult: integer - -.

FilePos(var F): longint - . .

FileSize(var F): longint - .

Eoln(var F: TextFile): boolean - True, .

Eof(var F)): boolean - True, .

SeekEoln(var F: TextFile): boolean True, , .

SeekEof(var F: TextFile): boolean - , SeekEoln, .

BlockRead(var F: File; var Buf; Count: word[; Result: word]), BlockWrite(var F: File; var Buf; Count: word[; Result: word]) - Buf Count .

8.4. TOpenDialog TSaveDialog

TOpenDialog TSaveDialog DIALOGS. , .. . . . , . a FileName. , , Filter, , , , DefaultExt. , Title.

8.5.

: , , . , , . , TMemo, .

8.5.1. TOpenDialog TSaveDialog

TOpenDialog TSaveDialog , Dialogs . . , Filter . Filter Editor, , , . OpenDialod1 . 8.1. *.dat , dat, *.* - ( ).

. 8.1.

, dat, DefaultExt .dat. SaveDialog1 ( txt).

. 8.2.

8.5.2.

. . , , . . . 8.2. , . Close .

8.1.

8.1.

unit unit8;

Interface

uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, ExtCtrls;

Type

TForm1 = class (TForm)

Edit1: TEdit;

Edit2: TEdit;

Edit3: TEdit;

Edit4: TEdit;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Memo1: TMemo;

Button1: TButton;

Button3: TButton;

Splitter1: TSplitter;

Button5: TButton;

BitBtn1: TBitBtn;

SaveDialog1: TSaveDialog;

Button2: TButton;

OpenDialog1: TOpenDialog;

Button4: TButton;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

private { Private declarations }

public { Public declarations }

end;

Type

TStudent = record

FIO: string[40]; // ...

otc: array[1..3] of word; //

sball: extended; //

end;

Var

Fz: file of Tstudent; //

Ft: TextFile; //

Stud: array[1..100] of Tstudent; //

nzap: integer; //

FileNameZ, FileNameT: string; //

Var

Form1: TForm1;

Implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);

Begin

Edit1.Clear; Edit2.Clear; Edit3.Clear; Edit4.Clear;

Memo1.Clear;

Button1.Hide; //

nzap:=0;

end;

 

procedure TForm1.Button1Click(Sender: TObject); //

Begin

nzap:=nzap+1;

with stud[nzap] do begin

FIO:=Edit1.Text;

otc[1]:=StrToInt(Edit2.Text);

otc[2]:=StrToInt(Edit3.Text);

otc[3]:=StrToInt(Edit4.Text);

sball:=(otc[1]+otc[2]+otc[3])/3;

Memo1.Lines.Add(fio+ +IntToStr(otc[1])+ + IntToStr(otc[2])+

+IntToStr(otc[3]));

end;

Write(fz,Stud[nzap]); //

Edit1.Clear; Edit2.Clear; Edit3.Clear; Edit4.Clear;

end;

procedure TForm1.Button2Click(Sender: TObject); //

begin //

OpenDialog1.Title:= ; //

//

if OpenDialog1.Execute then //

begin //

FileNameZ:= OpenDialog1.FileName; //

//

AssignFile(Fz, FileNameZ); // Fz

// c

Rewrite(Fz); //

end;

Button1.Show; //

end;

 

procedure TForm1.Button3Click(Sender: TObject); //

begin //

if OpenDialog1.Execute then //

begin //

FileNameZ:= OpenDialog1.FileName; //

AssignFile(Fz, FileNameZ); // Fz

// c

Reset(Fz); //

end;

nzap:=0;

while not eof(fz) do begin

nzap:=nzap+1;

Read(fz,stud[nzap]); //

with stud[nzap] do

Memo1.Lines.Add(fio+ +IntToStr(otc[1])+ +IntToStr(otc[2])+

+IntToStr(otc[3]));

end;

Button1.Show; //

end;

 

procedure TForm1.Button4Click(Sender: TObject); //

var i,j: word;

st: TStudent;

Begin

for i:=1 to nzap-1 do //

for j:=i+1 to nzap do





:


: 2016-11-18; !; : 434 |


:

:

.
==> ...

1506 - | 1431 -


© 2015-2024 lektsii.org - -

: 0.08 .