thuvien
Program QuanLy;
uses crt;
type
Khach=record
Ma:string;
Ten:string;
Sn:string;
Dchi:string;
end;
NhanVien=record
Ma:string;
Ten:string;
Sn:string;
Dchi:string;
end;
Sach=record
Ma:string;
Ten:string;
TG:string;
NXB:string;
TT:string;
end;
Var
KH:array[1..10] of Khach;
NV:array[1..10] of NhanVien;
S:array[1..10] of Sach;
lap:char;chon:byte;
i,j,n,m,l,k:integer;
Procedure Tao_Khach;
Begin
clrscr;
Writeln('Bat dau tao danh sach khach hang ');
i:=1;
Repeat
With KH[i] do begin
Write(' Ma khach ');readln(Ma);
Write(' Ten Khach ');readln(Ten);
Write(' Ngay sinh ');readln(Sn);
Write(' Dia chi ');readln(Dchi);
end;
i:=i+1;
Writeln(' Nhap tiep (C/K) ? ');readln(lap);
Until upcase(lap)='K';
j:=i;
End;
Procedure Tao_NhanVien;
Begin
clrscr;
Writeln('Bat dau tao danh sach nhan vien ');
i:=1;
Repeat
With NV[i] do begin
Write(' Ma NV ');readln(Ma);
Write(' Ten NV ');readln(Ten);
Write(' Ngay sinh ');readln(Sn);
Write(' Dia chi ');readln(Dchi);
end;
i:=i+1;
Writeln(' Nhap tiep (C/K) ? ');readln(lap);
Until upcase(lap)='K';
n:=i;
End;
Procedure Tao_Sach;
Begin
clrscr;
Writeln('Bat dau tao danh sach khach hang ');
i:=1;
Repeat
With S[i] do begin
Write(' Ma sach ');readln(Ma);
Write(' Ten sach ');readln(Ten);
Write(' Tac gia ');readln(TG);
Write(' Nam Xuat Ban ');readln(NXB);
TT:='Roi';
end;
i:=i+1;
Writeln(' Nhap tiep (C/K) ? ');readln(lap);
Until upcase(lap)='K';
l:=i;
End;
Procedure Muon;
Var
MKH,TenS,TenTG,TenNV:string;
Begin
clrscr;
Writeln(' Nhap vao cac thong so sau ');
Writeln(' Nhap Ma khach hang ');readln(MKH);
Writeln(' Nhap ten sach '); readln(TenS);
Writeln(' Nhap ten tac gia ');readln(TenTG);
Writeln(' Nhap ten nhan vien ');readln(TenNV);
Writeln(' Phieu muon sach ');
Write('|MaKH|','TenKH|','TenNV|','MaS|','TenS|','TenTG|','T.Thai|');writeln;
write('--------------------------------------');writeln;
For i:=1 to l do
With S[i] do begin
If ((Ten=TenS) and (TT='Ban')) then begin
Writeln(' Sach ban, Khong muon duoc ');
End;
End;
For i:=1 to l do
With S[i] do
IF ((Ten=TenS) and (TT='Roi')) then begin
For m:=1 to j do
With KH[m] do begin
If Ma=MKH then
write('|',Ma:4,'|',Ten:4);End;write(' ');
For k:=1 to n do
With NV[k] do begin
If Ten=TenNV then
write('|',Ten:4);End;write(' ');
TT:='Ban';
Write('|',Ma:3,'| ',Ten:3,'| ',TG:4,'| ',TT:5,'|');writeln;
write('--------------------------------------'); writeln;
End;
End;
Procedure Tra;
Var
MKH,MS:string;
Begin
clrscr;
writeln(' Quan ly tra sach ');
Writeln(' Nhap vao Ma khach hang ');readln(MKH);
Writeln(' Nhap vao Ma sach ');readln(MS);
Writeln(' Phieu tra sach');
Write('|MaKH|','TenKH|','MaS','|TenS','|T.Thai|');writeln;
write('----------------------------');writeln;
For i:=1 to j do
With KH[i] do begin
If Ma=MKH then write('|',Ma:4,'|',Ten:5);
End;
For k:=1 to l do
With S[k] do begin
If Ma=MS then begin
TT:='Roi';
write('|',Ma:3,'|',Ten:4,'|',TT:6,'|');writeln;
write('++++++++++++++++++++++++++++');writeln;
End;
End;
End;
BEGIN
clrscr;
Writeln(' Chuong trinh quan ly sach');
Repeat
writeln(' Chon cac chuc nang sau');
Writeln('1. Quan ly khach hang');
Writeln('2. Quan ly nhan vien');
Writeln('3. Quan ly sach');
Writeln('4. Quan ly muon sach');
Writeln('5. Quan ly tra sach');
Writeln('6. Thoat');
Readln(chon);
Case chon of
1: Tao_Khach;
2: Tao_NhanVien;
3: Tao_Sach;
4: Muon;
5: Tra;
End;
Until chon=6;
Readln
End.
Bạn đang đọc truyện trên: AzTruyen.Top