passcal
Program Quanlysachthuvien;
Uses CRT;
Const max=200;
Type Sach=Record
masach:String[4];
tensach:String[31];
tacgia:String[20];
nxb:String[20];
gia:word;
End;
Mang=Array[1..max] of Sach;
Var a:Mang; n:byte; chon:char;
{-----Phan nhap danh sach-----}
Procedure nhapdanhsach;
Var chon:char;
Begin
Clrscr;
Writeln('Nhap Danh Sach Cac Cuon Sach Cua Thu Vien');
Repeat
n:=n+1;
With a[n] do
Begin
Write('Ma Sach: '); Readln(masach);
Write('Ten Sach: '); Readln(tensach);
Write('Ten Tac Gia: '); Readln(tacgia);
Write('Nha Xuat Ban: '); Readln(nxb);
Write('Gia sach (VND): '); Readln(gia);
End;
Writeln('Nhan phim bat ky de nhap tiep/ Nhan ESC de ket thuc');
chon:=readkey;
Until (chon=#27) or (n=Max);
End;
{-----Phan In Danh Muc Sach-----}
Procedure danhmucsach;
Var i:byte;
Begin
Clrscr;
Writeln('Danh Muc Sach Hien Co');
Writeln;
Writeln('STT Ten Sach Tac gia NXB Gia(VND)');
For i:=1 to n do
With a[i] do
Writeln(i:1, tensach:12, tacgia:13, nxb:20, gia:20);
Readln;
End;
{-----Phan tim sach theo ma so------}
Procedure timtheoma;
Var t:string[10];
i:byte;
kq:boolean;
Begin
Write('Nhap ma so sach can tim: ');
Readln(t);
i:=1;
kq:=false;
While (i<=n) and (kq=false) do
If a[i].masach=t then kq:=true else
i:=i+1;
If kq then
With a[i] do
Writeln(i:1, tensach:12, tacgia:13, nxb:20, gia:20)
Else Write('Khong tim thay ma sach nay!');
Readln;
End;
{-----Phan tim sach theo ten tac gia-----}
Procedure timtheotacgia;
Var t:string[20];
i:Byte;
Begin
Write('Nhap ten tac gia can tim: ');
Readln(t);
Writeln('Danh muc sach cua tac gia can tim: ');
Writeln('STT Ten Sach Tac gia NXB Gia');
For i:=1 to n do
With a[i] do if tacgia=t then
Writeln(i:1, tensach:12, tacgia:13, nxb:20, gia:20);
Readln;
End;
{-----Phan tim sach theo ten-----}
Procedure timtheoten;
Var t:string[10];
i:Byte;
Begin
Write('Nhap ten sach: ');
Readln(t);
Writeln('Danh muc sach can tim: ');
Writeln('STT Ten Sach Tac gia NXB Gia');
For i:=1 to n do
With a[i] do if pos(t,tensach)<>0 then
Writeln(i:1, tensach:12, tacgia:13, nxb:20, gia:20);
Readln;
End;
{-----Phan than chuong trinh-----}
Begin
n:=0;
Repeat
Clrscr;
Textbackground(9);
Clrscr;
TextColor(15);
Writeln(' ');
Writeln(' ');
Writeln(' Chuong trinh quan ly sach thu vien ');
Writeln(' ');
Writeln(' Lop 54CLC2 ');
Writeln(' Khoa ki su chat luong cao ');
Writeln(' Truong Dai hoc xay dung ');
Writeln(' Copyright by Nhom "Cac con ga passcal" ');
Writeln(' ');
Writeln(' ');
Writeln;
Writeln('Nhan phim 1 de Nhap danh muc sach');
Writeln('Nhan phim 2 de In danh muc sach');
Writeln('Nhan phim 3 de Tim sach theo ma so sach');
Writeln('Nhan phim 4 de Tim sach theo tac gia');
Writeln('Nhan phim 5 de Tim sach theo ten sach');
Writeln('Nhan ESC de thoat');
Chon:=readkey;
Case chon of
'1':nhapdanhsach;
'2':danhmucsach;
'3':timtheoma;
'4':timtheotacgia;
'5':timtheoten;
end;
Until chon=#27;
End.
Bạn đang đọc truyện trên: AzTruyen.Top