Uses CRT;
TYPE
Plant=Record
TabN:Word;
Surname:String;
Workshop:Byte;
Post:String;
end;
VAR
Wk:Array[1..100] of Plant;
Nwk,i,j,ActNum,SearchType,Wsh:Byte;
y_n:Char;
TN:Word;
SN,P:String;
BEGIN
REPEAT
ClrScr;
Writeln('Выберите номер действия: ');
WriteLn('1: Ввод данных');
WriteLn('2: Поиск');
WriteLn('3: Выход');
ReadLn(ActNum);
CASE ActNum of
1: begin
ClrScr;
Nwk:=0;
Repeat
Write('Следующий работник (y/n)? ');
ReadLn(y_n);
If (y_n='y') or (y_n='Y') then
begin
Inc(Nwk);
Writeln('Табельный номер (4 цифры макс.):');
ReadLn(Wk[Nwk].TabN);
Writeln('Фамилия (17 символов макс.):');
ReadLn(Wk[Nwk].Surname);
Writeln('Номер цеха (3 цифры макс.):');
ReadLn(Wk[Nwk].Workshop);
Writeln('Должность (15 символов макс.):');
ReadLn(Wk[Nwk].Post);
end;
Until (y_n='n') or (y_n='N');
ClrScr;
For i:=1 to Nwk do
With Wk[i] do
begin
Write(TabN:4,' ',Surname);
for j:=Length(Surname) to 18 do write(' ');
Writeln(Workshop:3,' ',Post);
end;
WriteLn('Press "Enter" to continue...');
ReadLn;
end;
2: begin
ClrScr;
WriteLn('Поиск по:');
WriteLn('1: Табельному номеру');
WriteLn('2: Фамилии');
WriteLn('3: Номеру цеха');
WriteLn('4: Должности');
ReadLn(SearchType);
Case SearchType of
1: begin
ClrScr;
Write('Табельный номер для поиска: ');
Readln(TN);
For i:=1 to Nwk do
If Wk[i].TabN=TN then
With Wk[i] do
begin
Write(TabN:4,' ',Surname);
for j:=Length(Surname) to 18 do write(' ');
Writeln(Workshop:3,' ',Post);
end;
WriteLn('Press "Enter" to continue...');
ReadLn;
end;
2: begin
ClrScr;
Writeln('Фамилия для поиска: ');
Readln(SN);
For i:=1 to Nwk do
If Wk[i].Surname=SN then
With Wk[i] do
begin
Write(TabN:4,' ',Surname);
for j:=Length(Surname) to 18 do write(' ');
Writeln(Workshop:3,' ',Post);
end;
WriteLn('Press "Enter" to continue...');
ReadLn;
end;
3: begin
ClrScr;
Write('Номер цеха для поиска: ');
Readln(Wsh);
For i:=1 to Nwk do
If Wk[i].Workshop=Wsh then
With Wk[i] do
begin
Write(TabN:4,' ',SurName);
for j:=Length(Surname) to 18 do write(' ');
Writeln(Workshop:3,' ',Post);
end;
WriteLn('Press "Enter" to continue...');
ReadLn;
end;
4: begin
ClrScr;
Write('Должность для поиска: ');
Readln(P);
For i:=1 to Nwk do
If Wk[i].Post=P then
With Wk[i] do
begin
Write(TabN:4,' ',Surname);
for j:=Length(Surname) to 18 do write(' ');
Writeln(Workshop:3,' ',Post);
end;
WriteLn('Press "Enter" to continue...');
ReadLn;
end;
end;
end;
3: Halt;
End;
UNTIL 0=1;
END.