Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
19
Добавлен:
10.12.2013
Размер:
5.9 Кб
Скачать
Uses Crt;

Const
LenghtFIO = 30;
Name = 'Base.dat';

Type
Worker = Record
FIO: String[LenghtFIO];
Kafedra,Dolgnost,Razrad: Byte;
Stavka,Oklad,Zarplata: Real;
End;

Var i: Byte;
Index: Byte;
f: Text;

Procedure Header(s:String);
Begin
ClrScr;
TextColor(Yellow);
GotoXY(35,1); Write(s);
GotoXY(1,3);
TextColor(LightGray);
End;

Procedure MaxIndex;
Begin
Reset(f);
Index:= 0;
While not EOF(f) Do Begin
ReadLn(f);
Inc(Index);
End;
if Index<>0 then Dec(Index,2);
End;

Procedure Viewing;
Var s: String[80];
Begin
Reset(f);
Header('Џа®б¬®ва');
TextColor(Brown);
ReadLn(f,s); WriteLn(s);
TextColor(LightGray);
While not EOF(f) Do Begin
ReadLn(f,s);
Writeln(s);
End;
ReadKey;
End;

Procedure Additing;
Var W: Worker;
Begin
Append(f);
Repeat
With W Do Begin
Write('”€Ћ: '); ReadLn(FIO);
Write('Љ дҐ¤а : '); ReadLn(Kafedra);
Write('„®«¦­®бвм: '); ReadLn(Dolgnost);
Write('ђ §ап¤: '); ReadLn(Razrad);
Write('‘в ўЄ : '); ReadLn(Stavka);
Write('ЋЄ« ¤: '); ReadLn(Oklad);
Zarplata:= Stavka * Oklad;
WriteLn(f,FIO:LenghtFIO,Kafedra:3,Dolgnost:5,
Razrad:7,Stavka:7:1,Oklad:10:2,Zarplata:10:2);
End;
WriteLn;
WriteLn('Enter - ¬Ґ­о');
WriteLn('‹оЎ п ¤агЈ п - Їа®¤®«¦Ёвм');
Until ReadKey=#13;
End;
{
Procedure Editing;
Begin
Repeat
Header('€§¬Ґ­Ґ­ЁҐ');
Write('‚ўҐ¤ЁвҐ ­®¬Ґа Є ав®зЄЁ: ');
ReadLn(i);
if not (i in [1..MaxIndex]) then Begin
TextColor(Brown);
WriteLn('ЌҐЇа ўЁ«м­® ўўҐ¤Ґ­ ­®¬Ґа Є ав®зЄЁ!');
WriteLn('Ћ­ ¤®«¦Ґ­ Ўлвм: 1..',MaxIndex);
TextColor(LightGray);
ReadKey;
Break;
End
Else With a[i] Do Begin
Write('”€Ћ: '); ReadLn(FIO);
Write('Љ дҐ¤а : '); ReadLn(Kafedra);
Write('„®«¦­®бвм: '); ReadLn(Dolgnost);
Write('ђ §ап¤: '); ReadLn(Razrad);
Write('‘в ўЄ : '); ReadLn(Stavka);
Write('ЋЄ« ¤: '); ReadLn(Oklad);
Zarplata:= Stavka * Oklad;
End;
WriteLn;
WriteLn('Enter - ¬Ґ­о');
WriteLn('‹оЎ п ¤агЈ п - Їа®¤®«¦Ёвм');
Until ReadKey=#13;
End;

Procedure ClearArray;
Begin
For i:=1 to MaxIndex Do
With a[i] Do Begin
FIO:='” ¬Ё«Ёп €¬п ЋвзҐбвў®';
Kafedra:=0;
Dolgnost:=0;
Razrad:=0;
Stavka:=0;
Oklad:=0;
Zarplata:=0;
End;
End;

Procedure Deleting;
Begin
Repeat
Header('“¤ «Ґ­ЁҐ');
Writeln('‚ўҐ¤ЁвҐ:');
Writeln('1 - зв®Ўл г¤ «Ё«Ёвм ®¤­г § ЇЁбм');
Writeln('0 - зв®Ўл г¤ «Ё«Ёвм ўбҐ § ЇЁбЁ');
Case ReadKey of
'1': Begin
Write('‚ўҐ¤ЁвҐ ­®¬Ґа Є ав®зЄЁ: ');
ReadLn(i);
With a[i] Do Begin
FIO:='” ¬Ё«Ёп €¬п ЋвзҐбвў®';
Kafedra:=0;
Dolgnost:=0;
Razrad:=0;
Stavka:=0;
Oklad:=0;
Zarplata:=0;
End;
TextColor(Red);
WriteLn('„ ­­лҐ г¤ «Ґ­л');
TextColor(LightGray);
End;
'0': Begin
ClearArray;
TextColor(Red);
WriteLn('‚ᥠ¤ ­­лҐ г¤ «Ґ­л');
TextColor(LightGray);
End;
End;
Writeln;
WriteLn('Enter - ¬Ґ­о');
WriteLn('‹оЎ п ¤агЈ п - Їа®¤®«¦Ёвм');
Until ReadKey=#13;
End;

Procedure Searching;
Var W: Worker;
C: Boolean;
i,j,l,p: Byte;
Begin
Repeat
ClrScr;
Header('Џ®ЁбЄ');
WriteLn('1 - ”€Ћ');
WriteLn('2 - Љ дҐ¤а ');
WriteLn('3 - „®«¦­®бвм');
WriteLn('4 - ђ §ап¤');
WriteLn('5 - ‘в ўЄ ');
WriteLn('6 - ЋЄ« ¤');
WriteLn('7 - ‡ аЇ« в ');
WriteLn;
Case ReadKey of
'1': Begin
Write('”€Ћ: '); ReadLn(W.FIO);
l:= Length(W.FIO);
For i:=1 to MaxIndex Do Begin
p:= Pos(W.FIO[1],a[i].FIO);
if (p>0) and (p-1+l <= Length(a[i].FIO)) then Begin
c:= True;
For j:=2 to l Do
if a[i].FIO[p-1+j] <> W.FIO[j] then Begin
c:= False;
Break;
End;
if c then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End
Else Continue;
End;
End;
'2': Begin
Write('Љ дҐ¤а : '); ReadLn(W.Kafedra);
For i:= 1 to MaxIndex Do
if W.Kafedra = a[i].Kafedra then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End;
'3': Begin
Write('„®«¦­®бвм: '); ReadLn(W.Dolgnost);
For i:= 1 to MaxIndex Do
if W.Dolgnost = a[i].Dolgnost then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End;
'4': Begin
Write('ђ §ап¤: '); ReadLn(W.Razrad);
For i:= 1 to MaxIndex Do
if W.Razrad = a[i].Razrad then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End;
'5': Begin
Write('‘в ўЄ : '); ReadLn(W.Stavka);
For i:= 1 to MaxIndex Do
if W.Stavka = a[i].Stavka then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End;
'6': Begin
Write('ЋЄ« ¤: '); ReadLn(W.Oklad);
For i:= 1 to MaxIndex Do
if W.Oklad = a[i].Oklad then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End;
'7': Begin
Write('‡ аЇ« в : '); ReadLn(W.Zarplata);
For i:= 1 to MaxIndex Do
if W.Zarplata = a[i].Zarplata then With a[i] Do
WriteLn(FIO:LenghtFIO,Kafedra:7,Dolgnost:10,
Razrad:7,Stavka:7:1,Oklad:8:2,Zarplata:8:2);
End;
End;
WriteLn;
WriteLn('Enter - ¬Ґ­о');
WriteLn('‹оЎ п ¤агЈ п - Їа®¤®«¦Ёвм');
Until ReadKey=#13;
End;
}
Begin
Assign(f,Name);
Repeat
Header('‹ Ў®а в®а­ п 10');
WriteLn('1 - Џа®б¬®ва');
WriteLn('2 - „®Ў ўЁвм');
WriteLn('3 - €§¬Ґ­Ёвм');
WriteLn('4 - “¤ «Ёвм');
WriteLn('5 - Џ®ЁбЄ');
WriteLn('6 - ‘®авЁа®ўЄ ');
WriteLn('Esc - ‚л室');
Case ReadKey of
'1': Viewing;
'2': Additing;
{'2': Editing;
'3': Deleting;
'4': Searching;}
#27: Begin
{Writing;}
Close(f);
Exit;
End;
End;
Until 1<>1
End.
Соседние файлы в папке 10