Добавил:
Studfiles2
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабы+Курсовик / Посохов / Lab004
.pas { ‚ д ©« F_in.dat § ЇЁб вм ¤ лҐ ®Ў г票Є е: ”.€.Ћ., ¤ в ஦¤.,
¤®¬. ¤аҐб Ё ⥫Ґд®. ’ॡгҐвбп:
1) ђ бЇҐз в вм бЇЁб®Є гз йЁебп.
2) ЋЇаҐ¤Ґ«Ёвм д ¬Ё«Ёо бв а襣® Ё ¬« ¤иҐЈ® г票Є®ў.
3) ‘д®а¬Ёа®ў вм д ©« F_ayt.dat, ᮤҐа¦ йЁ© д ¬Ё«ЁЁ Ё ¤аҐб г票Є®ў
தЁўиЁебп ў § ¤ ®¬ ¬ҐбпжҐ.}
Program Student;
Uses Crt,Printer,Lab004M; {Ї®¤Є«о票Ґ ¬®¤г«Ґ©}
Type
Date = Record
Year,Month,Day: Word;
End;
Person = Record
FirstName: String[15];
LastName: String[25];
VaterName: String[25];
Date:Date;
Address: String[35];
Telefon: String[9];
End;
Var PersonFile: File of Person;
OutFile: Text;
{1. ‡ Ї®«ҐЁҐ д ©« .********************************************************}
Procedure EingabeMenu;
Var I,N:Byte;
X:Person;
BEGIN
ReWrite(PersonFile);
Windows(20,11,60,12);
ZeigeCursor;
Write('‚ўҐ¤ЁвҐ Є®«-ў® § ЇЁбҐ©: '); ReadLn(N);
For I:=1 to N do Begin
Windows(15,7,65,17);
TextColor(Green);
WriteLn('‡ ЇЁбм ь ',I,' Ё§ ',N);
TextColor(LightGray);
Write('” ¬Ё«Ёп: '); ReadLn(X.FirstName);
Write('€¬п: '); ReadLn(X.LastName);
Write('ЋвзҐбвў®: '); ReadLn(X.VaterName);
WriteLn('„ в ஦¤ҐЁп: ');
Write('ѓ®¤: '); ReadLn(X.Date.Year);
Write('ЊҐбпж: '); ReadLn(X.Date.Month);
Write('„Ґм: '); ReadLn(X.Date.Day);
Write('Ђ¤аҐб: '); ReadLn(X.Address);
Write('’Ґ«Ґд®: '); ReadLn(X.Telefon);
Write(PersonFile,X);
End;
DeleteCursor;
Close(PersonFile);
END;
{2. ЏҐз вм.******************************************************************}
Procedure Print;
Var I:Integer;
X:Person;
BEGIN
Reset(PersonFile);
Windows(23,11,56,12);
TextColor(Green);
Write('Џа®ўҐам⥠Ј®в®ў®бвм ЇаЁвҐа ! ');
TextColor(LightGray);
PressAnyKey;
Windows(1,5,80,20);
WriteLn(' ” ¬Ё«Ёп | €¬п | ЋвзҐбвў® | „ в ஦¤. | Ђ¤аҐб | ’Ґ«Ґд® |');
WriteLn(Lst,' ” ¬Ё«Ёп | €¬п | ЋвзҐбвў® | „ в ஦¤. | Ђ¤аҐб | ’Ґ«Ґд® |');
For I:=1 to FileSize(PersonFile) do Begin
Read(PersonFile,X);
Write(X.FirstName:10,' |',X.LastName:10,' |',X.VaterName:11,' |');
Write(X.Date.Day:3,'/',X.Date.Month:2,'/',X.Date.Year:4,' |');
WriteLn(X.Address:16,' |',X.Telefon:9,' |');
Write(Lst,X.FirstName:10,' |',X.LastName:10,' |',X.VaterName:11,' |');
Write(Lst,X.Date.Day:3,'/',X.Date.Month:2,'/',X.Date.Year:4,' |');
WriteLn(Lst,X.Address:16,' |',X.Telefon:9,' |');
End;
WriteLn('„ лҐ ®вЇа ў«Ґл ЇаЁвҐа ...');
Close(PersonFile);
PressAnyKey;
END;
{3. ЋЇаҐ¤Ґ«ҐЁҐ д ¬Ё«ЁЁ бв а襣® Ё ¬« ¤иҐЈ® г票Є®ў.************************}
Procedure Fio;
BEGIN
Windows(23,11,56,12);
TextColor(Green);
WriteLn('‚ а §а Ў®вЄҐ!!!!!!!!!!!!!!!!!!!');
TextColor(LightGray);
PressAnyKey;
END;
{4. ”®а¬Ёа®ў ЁҐ д ©« .******************************************************}
Procedure FileErzeugung;
Var I:Integer;
X:Person;
NMonth:Word;
K:Byte;
StrMonth:String;
BEGIN
Windows(23,11,56,12);
ZeigeCursor;
Write('‚ўҐ¤ЁвҐ ®¬Ґа ¬Ґбпж : ');Readln(NMonth);
DeleteCursor;
Case NMonth of
1: Strmonth:='џў аҐ';
2: Strmonth:='”Ґўа «Ґ';
3: Strmonth:='Њ авҐ';
4: Strmonth:='ЂЇаҐ«Ґ';
5: Strmonth:='Њ Ґ';
6: Strmonth:='€оҐ';
7: Strmonth:='€о«Ґ';
8: Strmonth:='ЂўЈгбвҐ';
9: Strmonth:='‘ҐвпЎаҐ';
10: Strmonth:='ЋЄвпЎаҐ';
11: Strmonth:='Ќ®пЎаҐ';
12: Strmonth:='„ҐЄ ЎаҐ';
End;
Assign(OutFile,'F_ayt.dat');
ReWrite(OutFile);
Reset(PersonFile);
WriteLn(OutFile,'“票ЄЁ, தЁўиЁҐбп ў ',strMonth,' ¬ҐбпжҐ.');
WriteLn(OutFile,' ” ¬Ё«Ёп | Ђ¤аҐб |');
K:=0;
For I:=1 to FileSize(PersonFile) do Begin
Read(PersonFile,X);
If X.Date.Month=NMonth then Begin
WriteLn(OutFile,X.FirstName:16,' |',X.Address:30,' |');
inc(K);
End;
End;
WriteLn(OutFile,'--------------------');
WriteLn(OutFile,'€в®Ј® ',K,' 祫®ўҐЄ.');
Close(PersonFile);
Close(OutFile);
Windows(20,10,61,12);
WriteLn('Љ®«ЁзҐбвў® г票Є®ў, தЁўиЁебп ў ',strMonth,' ¬ҐбпжҐ ',K,' 祫®ўҐЄ.');
PressAnyKey;
END;
{ѓ« ў®Ґ ¬Ґо.***************************************************************}
Procedure HauptMenu;
Var HotKey:Char;
Position:Byte;
BEGIN
HotKey:=#0;
Position:=1;
Repeat
Windows(15,9,66,15);
If Position=1 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('1. ‚ў®¤ ¤ ле.');
If Position=2 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('2. ЏҐз вм бЇЁбЄ гз йЁебп.');
If Position=3 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('3. ЋЇаҐ¤Ґ«ҐЁҐ д ¬Ё«ЁЁ бв а襣® Ё ¬« ¤иҐЈ® г票Є .');
If Position=4 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('4. ”®а¬Ёа®ў ЁҐ д ©« .');
TextBackGround(Blue);
GotoXY(9,6);
Write('ESC - ‚л©вЁ Ё§ Їа®Ја ¬¬л.');
HotKey:=ReadKey;
Cursor(Hotkey,Position,4);
If (HotKey=#13) then Case Position Of
1: HotKey:='1';
2: HotKey:='2';
3: HotKey:='3';
4: HotKey:='4';
End;
Case HotKey Of
'1': EingabeMenu;
'2': Print;
'3': FIO;
'4': FileErzeugung;
End;
Until (HotKey=#27) or (HotKey=#68);
END;
{****************************************************************************}
BEGIN
Assign(PersonFile,'F_in.dat');
HauptMenu; {‚맮ў Ј« ў®Ј® ¬Ґо}
END.
¤®¬. ¤аҐб Ё ⥫Ґд®. ’ॡгҐвбп:
1) ђ бЇҐз в вм бЇЁб®Є гз йЁебп.
2) ЋЇаҐ¤Ґ«Ёвм д ¬Ё«Ёо бв а襣® Ё ¬« ¤иҐЈ® г票Є®ў.
3) ‘д®а¬Ёа®ў вм д ©« F_ayt.dat, ᮤҐа¦ йЁ© д ¬Ё«ЁЁ Ё ¤аҐб г票Є®ў
தЁўиЁебп ў § ¤ ®¬ ¬ҐбпжҐ.}
Program Student;
Uses Crt,Printer,Lab004M; {Ї®¤Є«о票Ґ ¬®¤г«Ґ©}
Type
Date = Record
Year,Month,Day: Word;
End;
Person = Record
FirstName: String[15];
LastName: String[25];
VaterName: String[25];
Date:Date;
Address: String[35];
Telefon: String[9];
End;
Var PersonFile: File of Person;
OutFile: Text;
{1. ‡ Ї®«ҐЁҐ д ©« .********************************************************}
Procedure EingabeMenu;
Var I,N:Byte;
X:Person;
BEGIN
ReWrite(PersonFile);
Windows(20,11,60,12);
ZeigeCursor;
Write('‚ўҐ¤ЁвҐ Є®«-ў® § ЇЁбҐ©: '); ReadLn(N);
For I:=1 to N do Begin
Windows(15,7,65,17);
TextColor(Green);
WriteLn('‡ ЇЁбм ь ',I,' Ё§ ',N);
TextColor(LightGray);
Write('” ¬Ё«Ёп: '); ReadLn(X.FirstName);
Write('€¬п: '); ReadLn(X.LastName);
Write('ЋвзҐбвў®: '); ReadLn(X.VaterName);
WriteLn('„ в ஦¤ҐЁп: ');
Write('ѓ®¤: '); ReadLn(X.Date.Year);
Write('ЊҐбпж: '); ReadLn(X.Date.Month);
Write('„Ґм: '); ReadLn(X.Date.Day);
Write('Ђ¤аҐб: '); ReadLn(X.Address);
Write('’Ґ«Ґд®: '); ReadLn(X.Telefon);
Write(PersonFile,X);
End;
DeleteCursor;
Close(PersonFile);
END;
{2. ЏҐз вм.******************************************************************}
Procedure Print;
Var I:Integer;
X:Person;
BEGIN
Reset(PersonFile);
Windows(23,11,56,12);
TextColor(Green);
Write('Џа®ўҐам⥠Ј®в®ў®бвм ЇаЁвҐа ! ');
TextColor(LightGray);
PressAnyKey;
Windows(1,5,80,20);
WriteLn(' ” ¬Ё«Ёп | €¬п | ЋвзҐбвў® | „ в ஦¤. | Ђ¤аҐб | ’Ґ«Ґд® |');
WriteLn(Lst,' ” ¬Ё«Ёп | €¬п | ЋвзҐбвў® | „ в ஦¤. | Ђ¤аҐб | ’Ґ«Ґд® |');
For I:=1 to FileSize(PersonFile) do Begin
Read(PersonFile,X);
Write(X.FirstName:10,' |',X.LastName:10,' |',X.VaterName:11,' |');
Write(X.Date.Day:3,'/',X.Date.Month:2,'/',X.Date.Year:4,' |');
WriteLn(X.Address:16,' |',X.Telefon:9,' |');
Write(Lst,X.FirstName:10,' |',X.LastName:10,' |',X.VaterName:11,' |');
Write(Lst,X.Date.Day:3,'/',X.Date.Month:2,'/',X.Date.Year:4,' |');
WriteLn(Lst,X.Address:16,' |',X.Telefon:9,' |');
End;
WriteLn('„ лҐ ®вЇа ў«Ґл ЇаЁвҐа ...');
Close(PersonFile);
PressAnyKey;
END;
{3. ЋЇаҐ¤Ґ«ҐЁҐ д ¬Ё«ЁЁ бв а襣® Ё ¬« ¤иҐЈ® г票Є®ў.************************}
Procedure Fio;
BEGIN
Windows(23,11,56,12);
TextColor(Green);
WriteLn('‚ а §а Ў®вЄҐ!!!!!!!!!!!!!!!!!!!');
TextColor(LightGray);
PressAnyKey;
END;
{4. ”®а¬Ёа®ў ЁҐ д ©« .******************************************************}
Procedure FileErzeugung;
Var I:Integer;
X:Person;
NMonth:Word;
K:Byte;
StrMonth:String;
BEGIN
Windows(23,11,56,12);
ZeigeCursor;
Write('‚ўҐ¤ЁвҐ ®¬Ґа ¬Ґбпж : ');Readln(NMonth);
DeleteCursor;
Case NMonth of
1: Strmonth:='џў аҐ';
2: Strmonth:='”Ґўа «Ґ';
3: Strmonth:='Њ авҐ';
4: Strmonth:='ЂЇаҐ«Ґ';
5: Strmonth:='Њ Ґ';
6: Strmonth:='€оҐ';
7: Strmonth:='€о«Ґ';
8: Strmonth:='ЂўЈгбвҐ';
9: Strmonth:='‘ҐвпЎаҐ';
10: Strmonth:='ЋЄвпЎаҐ';
11: Strmonth:='Ќ®пЎаҐ';
12: Strmonth:='„ҐЄ ЎаҐ';
End;
Assign(OutFile,'F_ayt.dat');
ReWrite(OutFile);
Reset(PersonFile);
WriteLn(OutFile,'“票ЄЁ, தЁўиЁҐбп ў ',strMonth,' ¬ҐбпжҐ.');
WriteLn(OutFile,' ” ¬Ё«Ёп | Ђ¤аҐб |');
K:=0;
For I:=1 to FileSize(PersonFile) do Begin
Read(PersonFile,X);
If X.Date.Month=NMonth then Begin
WriteLn(OutFile,X.FirstName:16,' |',X.Address:30,' |');
inc(K);
End;
End;
WriteLn(OutFile,'--------------------');
WriteLn(OutFile,'€в®Ј® ',K,' 祫®ўҐЄ.');
Close(PersonFile);
Close(OutFile);
Windows(20,10,61,12);
WriteLn('Љ®«ЁзҐбвў® г票Є®ў, தЁўиЁебп ў ',strMonth,' ¬ҐбпжҐ ',K,' 祫®ўҐЄ.');
PressAnyKey;
END;
{ѓ« ў®Ґ ¬Ґо.***************************************************************}
Procedure HauptMenu;
Var HotKey:Char;
Position:Byte;
BEGIN
HotKey:=#0;
Position:=1;
Repeat
Windows(15,9,66,15);
If Position=1 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('1. ‚ў®¤ ¤ ле.');
If Position=2 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('2. ЏҐз вм бЇЁбЄ гз йЁебп.');
If Position=3 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('3. ЋЇаҐ¤Ґ«ҐЁҐ д ¬Ё«ЁЁ бв а襣® Ё ¬« ¤иҐЈ® г票Є .');
If Position=4 Then TextBackGround(red) Else TextBackGround(Blue);
WriteLn('4. ”®а¬Ёа®ў ЁҐ д ©« .');
TextBackGround(Blue);
GotoXY(9,6);
Write('ESC - ‚л©вЁ Ё§ Їа®Ја ¬¬л.');
HotKey:=ReadKey;
Cursor(Hotkey,Position,4);
If (HotKey=#13) then Case Position Of
1: HotKey:='1';
2: HotKey:='2';
3: HotKey:='3';
4: HotKey:='4';
End;
Case HotKey Of
'1': EingabeMenu;
'2': Print;
'3': FIO;
'4': FileErzeugung;
End;
Until (HotKey=#27) or (HotKey=#68);
END;
{****************************************************************************}
BEGIN
Assign(PersonFile,'F_in.dat');
HauptMenu; {‚맮ў Ј« ў®Ј® ¬Ґо}
END.
Соседние файлы в папке Посохов