Пермский Государственный Технический Университет
Кафедра ИТАС
Лабораторная №9
Выполнил: Попов М.В.
Проверил : Мосиенко А. Ю.
Пермь. 2008 г.
1=1
Esc:
1:
2:
3:
Uses Crt;
Type
Worker = Record
Familia,Imia,Otchestvo: String;
Kafedra,Dolgnost,Razrad: Byte;
Stavka,Oklad,Zarplata: Real;
End;
Const
MaxIndex = 10;
Var i: Byte;
a:array[1..MaxIndex] of Worker;
Procedure Header(s:String);
Begin
ClrScr;
TextColor(Yellow);
GotoXY(30,1); Write(s);
GotoXY(1,3);
TextColor(LightGray);
End;
Procedure Viewing;
Begin
Header('Просмотр');
For i:=1 to MaxIndex Do
With a[i] Do Begin
WriteLn(a[i].Familia,' ',a[i].Imia,' ',a[i].Otchestvo);
Write('Кафедра:',a[i].Kafedra:2);
Write(' Должность:',a[i].Dolgnost:2);
Write(' Разряд:',a[i].Razrad:3);
Write(' Ставка:',a[i].Stavka:5:2);
Write(' Оклад:',a[i].Oklad:7:2);
WriteLn(' Зарплата:',a[i].Zarplata:7:2);
End;
ReadKey;
End;
Procedure Editing;
Begin
Repeat
Header('Изменение');
Write('Введите номер карточки: ');
ReadLn(i);
With a[i] Do Begin
Write('Фамилия: '); ReadLn(a[i].Familia);
Write('Имя: '); ReadLn(a[i].Imia);
Write('Отчество: '); ReadLn(a[i].Otchestvo);
Write('Кафедра: '); ReadLn(a[i].Kafedra);
Write('Должность: '); ReadLn(a[i].Dolgnost);
Write('Разряд: '); ReadLn(a[i].Razrad);
Write('Ставка: '); ReadLn(a[i].Stavka);
Write('Оклад: '); ReadLn(a[i].Oklad);
a[i].Zarplata:= a[i].Stavka * a[i].Oklad;
End;
WriteLn;
WriteLn('Пробел - меню');
WriteLn('Любая другая - продолжить');
Until ReadKey=#32
End;
Procedure ClearArray;
Begin
For i:=1 to MaxIndex Do
With a[i] Do Begin
a[i].Familia:='Фамилия';
a[i].Imia:='Имя';
a[i].Otchestvo:='Отчество';
a[i].Kafedra:=0;
a[i].Dolgnost:=0;
a[i].Razrad:=0;
a[i].Stavka:=0;
a[i].Oklad:=0;
a[i].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
a[i].Familia:='Фамилия';
a[i].Imia:='Имя';
a[i].Otchestvo:='Отчество';
a[i].Kafedra:=0;
a[i].Dolgnost:=0;
a[i].Razrad:=0;
a[i].Stavka:=0;
a[i].Oklad:=0;
a[i].Zarplata:=0;
End;
TextColor(Red);
WriteLn('Данные удалены');
TextColor(LightGray);
End;
'0': Begin
ClearArray;
TextColor(Red);
WriteLn('Все данные удалены');
TextColor(LightGray);
End;
End;
Writeln;
WriteLn('Пробел - меню');
WriteLn('Любая другая - продолжить');
Until ReadKey=#32
End;
Begin
ClearArray;
Repeat
Header('Лабораторная 9');
WriteLn('1 - Просмотр');
WriteLn('2 - Изменить');
WriteLn('3 - Удалить');
WriteLn('Esc - Выход');
Case ReadKey of
'1': Viewing;
'2': Editing;
'3': Deleting;
#27: Exit;
End;
Until 1<>1
End.