Tải bản đầy đủ (.docx) (49 trang)

Quản lý thư viện bằng C++

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (97.29 KB, 49 trang )

Bài Tập Quản Lý Thư Viện Bằng Mãng :
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream>
struct thuvien
{
char ms[10],ts[20],theloai[20],tacgia[20],nxb[20];
int sl;
};
thuvien tv[100];
int n;
void nhap()
{
system("cls");
printf("\t\t \n");
printf("\t\t | MOI BAN NHAP TONG SO SACH BAN CAN NHAP VAO
THU VIEN |\n");
printf("\t\t \n");
printf("\t\t\t>>=======>\t NHAP:\t");
scanf("%d",&n);
for(int i=0;i<n;++i)
{
printf("\t\t>>=======>\tDAY LA QUYEN THU\t>>=======>>:
%d\n",i+1);
fflush(stdin);
printf("\n Nhap Ma Sach :\t");
gets(tv[i].ms);
printf("\n Nhap Ten Sach :\t");
gets(tv[i].ts);
printf("\n Nhap The Loai :\t");


gets(tv[i].theloai);
printf("\n NHap Tac Gia :\t");
gets(tv[i].tacgia);
printf("\n Nhap Nha Xuat ban:\t");
gets(tv[i].nxb);
printf("\n Nhap So Luong :\t");
scanf("%d",&tv[i].sl);
}
printf("\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();
}
void xuat()
{
system("cls");
int NguyenCungChanh=0;
for (int i=0;i<n;++i)
{
printf("\n\t\t\t\tQUYEN THU >>======> \t%d",++NguyenCungChanh);
printf("\n\t\t########################################################");
printf("\n\t\t| Ma Sach | \t%s ",tv[i].ms);
printf("\n\t\t# # #");
printf("\n\t\t| Ten Sach | \t%s ",tv[i].ts);
printf("\n\t\t# # #");
printf("\n\t\t| The Loai | \t%s ",tv[i].theloai);
printf("\n\t\t# # #");
printf("\n\t\t| Tac Gia | \t%s ",tv[i].tacgia);
printf("\n\t\t# # #");

printf("\n\t\t| NXB | \t%s ",tv[i].nxb);
printf("\n\t\t# # #");
printf("\n\t\t| So Luong | \t%d ",tv[i].sl);
printf("\n\t\t########################################################");
}
printf("\t\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();
}
void timkiem()
{
system("cls");
char ms[10];
printf("\n\t\t <-MOI BAN NHAP MA SACH DE BAN TIM THAY SACH
BAN MUON->:");
fflush(stdin);
gets(ms);
int k=0;
int i;
for (i=0;i<n;++i)
if(strcmp(ms,tv[i].ms)==0)
{
printf("\n\t\t\t\tQUYEN THU >>======> \t%d",++k);
printf("\n\t\t########################################################");
printf("\n\t\t| Ma Sach | \t%s ",tv[i].ms);
printf("\n\t\t# # #");
printf("\n\t\t| Ten Sach | \t%s ",tv[i].ts);
printf("\n\t\t# # #");

printf("\n\t\t| The Loai | \t%s ",tv[i].theloai);
printf("\n\t\t# # #");
printf("\n\t\t| Tac Gia | \t%s ",tv[i].tacgia);
printf("\n\t\t# # #");
printf("\n\t\t| NXB | \t%s ",tv[i].nxb);
printf("\n\t\t# # #");
printf("\n\t\t| So Luong | \t%d ",tv[i].sl);
printf("\n\t\t########################################################");
printf("\t\t\t < DAY LA THONG TIN MA SACH DAU TIEN MA BAN
NHAP >\n");
break;
}
if(i==n)
printf("\n\t\t < KHONG TIM THAY MA SACH BAN CAN
TIM >\n");
printf("\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();
}
void xoa()
{
system("cls");
printf("\t >>====> MOI BAN NHAP MA SACH BAN CAN XOA
>>===>\t");
char ms[10];
fflush(stdin);
gets(ms);
for(int i=0;i<n;++i)

if(strcmp(ms,tv[i].ms)==0)
{
for(int j=i;j<n-1;++j)
tv[j]=tv[j+1];
n;
break;
}
xuat();
}
void tang()
{
system("cls");
printf("\t\t < >\n");
printf("\t\t < SAP XEP SO LUONG SACH TU CAO XUONG
THAP >\n");
printf("\t\t < >\n");
for (int i=0;i<n-1;++i)
{
int m=i;
for(int j=i+1;j<n;++j)
if(tv[m].sl<tv[j].sl)
m=j;
thuvien t=tv[i];
tv[i]=tv[m];
tv[m]=t;
}
xuat();
}
void giam()
{

system("cls");
for (int i=1;i<n;++i)
{
int x=tv[i].sl;
for(int j=i-1;j>=0; j)
if(x<tv[j].sl)
tv[j+1].sl=tv[j].sl;
else
break;
tv[j+1].sl=x;
}
xuat();
}
void sapxep()
{
system("cls");
while (1)
{
printf("\t\t\t>>=======> >>=====>\t<=====<< <=======<<\n");
printf("\t\t \n");
printf("\t\t CHAO MUNG BAN DEN VOI THANH CONG CU SAP XEP
DON GIAN \n");
printf("\t\t \n");
printf("\t\t CO 2 THANH CONG CU SAP XEP (TANG) VA
(GIAM) \n");
printf("\t\t \n");
printf("\t\t NHAP Z .DE CHON TANG DAN \n");
printf("\t\t NHAP Y .DE CHON GIAM DAN \n");
printf("\t\t \n");
printf("\t\t THANH CONG CU NAY SAP XEP THEO SO LUONG SACH

MA BAN NHAP\n");
printf("\t\t \n");
printf("\t\t NHAP X . DE THOAT KHOI THANH CONG CU SAP
XEP \n");
printf("\t\t \n");
printf("\t\t\t MOI BAN NHAP (Z) HOAC (Y) DE XEM HIEU QUA\t");
char NguyenCungChanh;
scanf("%s",&NguyenCungChanh);
if (NguyenCungChanh=='x')
break;
else if(NguyenCungChanh=='z')
tang();
else if(NguyenCungChanh=='y')
giam();
}
}
void lietke()
{
system("cls");
char ms[10];
printf("\n\t\t < MOI BAN NHAP MA SACH BAN CAN LIET KE RA
>");
fflush(stdin);
gets(ms);
int NguyenCungChanh=0;
int i;
for (i=0;i<n;++i)
if(strcmp(ms,tv[i].ms)==0)
{
printf("\n\t\t\t\tQUYEN THU >>======> \t%d",++NguyenCungChanh);

printf("\n\t\t########################################################");
printf("\n\t\t| Ma Sach | \t%s ",tv[i].ms);
printf("\n\t\t# # #");
printf("\n\t\t| Ten Sach | \t%s ",tv[i].ts);
printf("\n\t\t# # #");
printf("\n\t\t| The Loai | \t%s ",tv[i].theloai);
printf("\n\t\t# # #");
printf("\n\t\t| Tac Gia | \t%s ",tv[i].tacgia);
printf("\n\t\t# # #");
printf("\n\t\t| NXB | \t%s ",tv[i].nxb);
printf("\n\t\t# # #");
printf("\n\t\t| So Luong | \t%d ",tv[i].sl);
printf("\n\t\t########################################################");
}
printf("\t\t\t\t>>=======> >>=====>\t<=====<< <=======<<\n");
printf("\t\t < >\n");
printf("\t\t < MINH DA LIET KE TAT CA THONG TIN SACH CO CUNG
MA SACH>\n");
printf("\t\t < >\n");
printf("\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();
}
void lonhon()
{
system("cls");
int CungChanh=0;
int SoCanNhapVao;

printf(">>===> >>===> NHAP SO LUONG SACH DE LIET KE SO
LUONG SACH > HON :\t");
scanf("%d",&SoCanNhapVao);
for (int NguyenCungChanh=0; NguyenCungChanh<n;NguyenCungChanh+
+)
if(tv[NguyenCungChanh].sl > SoCanNhapVao)
{
printf("\n\t\t\t\tQUYEN THU >>======> \t%d",++CungChanh);
printf("\n\t\t########################################################");
printf("\n\t\t| Ma Sach | \t%s ",tv[NguyenCungChanh].ms);
printf("\n\t\t# # #");
printf("\n\t\t| Ten Sach | \t%s ",tv[NguyenCungChanh].ts);
printf("\n\t\t# # #");
printf("\n\t\t| The Loai | \t%s ",tv[NguyenCungChanh].theloai);
printf("\n\t\t# # #");
printf("\n\t\t| Tac Gia | \t%s ",tv[NguyenCungChanh].tacgia);
printf("\n\t\t# # #");
printf("\n\t\t| NXB | \t%s ",tv[NguyenCungChanh].nxb);
printf("\n\t\t# # #");
printf("\n\t\t| So Luong | \t%d ",tv[NguyenCungChanh].sl);
printf("\n\t\t########################################################");
}
printf("\t\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();
}
void nhohon()
{

system("cls");
int SoCanNhapVao;
int CungChanh=0;
printf(">>====> >>===> NHAP SO LUONG SACH DE LIET KE SO
LUONG SACH < HON :\t");
scanf("%d",&SoCanNhapVao);
for (int NguyenCungChanh=0; NguyenCungChanh<n;NguyenCungChanh+
+)
if(tv[NguyenCungChanh].sl < SoCanNhapVao)
{
printf("\n\t\t\t\tQUYEN THU >>======> \t%d",++CungChanh);
printf("\n\t\t########################################################");
printf("\n\t\t| Ma Sach | \t%s ",tv[NguyenCungChanh].ms);
printf("\n\t\t# # #");
printf("\n\t\t| Ten Sach | \t%s ",tv[NguyenCungChanh].ts);
printf("\n\t\t# # #");
printf("\n\t\t| The Loai | \t%s ",tv[NguyenCungChanh].theloai);
printf("\n\t\t# # #");
printf("\n\t\t| Tac Gia | \t%s ",tv[NguyenCungChanh].tacgia);
printf("\n\t\t# # #");
printf("\n\t\t| NXB | \t%s ",tv[NguyenCungChanh].nxb);
printf("\n\t\t# # #");
printf("\n\t\t| So Luong | \t%d ",tv[NguyenCungChanh].sl);
printf("\n\t\t########################################################");
}
printf("\t\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();

}
int tong1()
{
int s=0;
int sl;
for(int i=0;i<n;++i)
s=s+tv[i].sl;
return s;
}
void tong()
{
system("cls");
while(1)
{
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t + BAN C0 CHAC RANG BAN MU0N XEM T0NG S0
LU0NG SACH +\n");
printf("\t\t + HIEN THU VIEN DANG CHUA KH0NG ????
+\n");
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t + Y(YES).MU0N XEM S0 LU0NG SACH
+\n");
printf("\t\t + N(N0).KH0NG MU0N XEM NUA +\n");
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t\t M0I BAN NHAP Y <==<<0R>>==> N :\t");
char v;
scanf("%s",&v);

if (v=='n')
break;
else if (v=='y')
system("cls");
int s;
printf("\n\n\n");
printf("\t>>====> Tong So Sach Dang Chua Trong Thu Vien La :
%d\t Quyen Sach\n", tong1());
printf("\n\n\n");
printf("\t\t < >\n");
printf("\t\t < NHAN ENTER DE VAO LAI MENU
>\n");
printf("\t\t < >\n");
getch();
}
}
void kieulk()
{
system("cls");
while(1)
{
printf("\t\t\t>>=======> >>=====>\t<=====<< <=======<<\n");
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t + MENU LIET KE +\n");
printf("\t\t + 1. LIET KE THEO MA SACH +\n");
printf("\t\t + 2.NHAP SO LUONG DE LIET KE SO LUONG LON
HON +\n");
printf("\t\t + 3.NHAP SO LUONG DE LIET KE SO LUONG NHO
HON +\n");

printf("\t\t + 0.THOAT MENU LIET KE +\n");
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t\t>>======>\tNHAP :\t");
int NguyenCungChanh;
scanf("%d",&NguyenCungChanh);
if (NguyenCungChanh==0)
break;
else if (NguyenCungChanh==1)
lietke();
else if (NguyenCungChanh==2)
lonhon();
else if (NguyenCungChanh==3)
nhohon();
}
}
void sua()
{
system("cls");
char ms[10],ts[20],theloai[20],tacgia[20],nxb[20];
int sl;
fflush(stdin);
printf("\n Nhap Ma So Can Sua:\t");
gets(ms);
printf("\n Nhap Ten Sach Moi:\t");
gets(ts);
printf("\n Nhap The Loai Moi:\t");
gets(theloai);
printf("\n Nhap Tac Gia Moi:\t");
gets(tacgia);

printf("\n Nhap Nha Xuat Ban Moi:\t");
gets(nxb);
printf("\n Nhap So Luong Sach Moi:\t");
scanf("%d",&sl);
for(int i=0;i<n;++i)
if (strcmp(ms,tv[i].ms)==0)
{
strcpy(tv[i].ms,ms);
strcpy(tv[i].ts,ts);
strcpy(tv[i].theloai,theloai);
strcpy(tv[i].tacgia,tacgia);
strcpy(tv[i].nxb,nxb);
tv[i].sl=sl;
}
xuat();
getch();
}
void menu()
{
system("cls");
while(1)
{
printf("\t\t\t>>=======> >>=====>\t<=====<< <=======<<\n");
printf("\t\t \n");
printf("\t\t|| DAY LA MENU CHINH CUA MINH MOI BAN XEM
KY ||\n");
printf("\t\t|| ||\n");
printf("\t\t|| 0.Thoat || || 4.Xoa ||\n");
printf("\t\t|| 1.Nhap || || 5.Sap Xep ||\n");
printf("\t\t|| 2.Xuat || || 6.Liet Ke ||\n");

printf("\t\t|| 3.Tim Kiem || || 7.Sua ||\n");
printf("\t\t|| || || 8.Tong ||\n");
printf("\t\t|| ||\n");
printf("\t\t|| LUU Y : NHAP SO VAO PHAI NHAN ENTER NHE
||\n");
printf("\t\t \n");
printf("\t\tDU LIEU HIEN DANG CON TRONG MOI BAN NHAN 1
DE NHAP DU LIEU :");
int N;
scanf("%d",&N);
if (N==0)
break;
else if(N==1)
nhap();
else if(N==2)
xuat();
else if(N==3)
timkiem();
else if(N==4)
xoa();
else if(N==5)
sapxep();
else if(N==6)
kieulk();
else if (N==7)
sua();
else if (N==8)
tong();
}
}

void caidatcham()
{
system("cls");
while(1)
{
printf("\t\t\t>>=======> >>=====>\t<=====<< <=======<<\n");
printf("\t\t+++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t+ QUAN LY THU VIEN
+\n");
printf("\t\t+ CHON Y.(YES) VAO MENU N.(N0)
THOAT +\n");
printf("\t\t+ +\n");
printf("\t\t+ NGUYEN CUNG CHANH
+\n");
printf("\t\t+ TM05A3 +\n");
printf("\t\t+ 12310433 +\n");
printf("\t\t+++++++++++++++++++++++++++++++++++++++++++++
++++++++++++\n");
printf("\t\t\t >>=====>\tMOI NHAP Y HOAC N :\t");
char NguyenCungChanh;
scanf("%s",&NguyenCungChanh);
if (NguyenCungChanh=='y')
menu();
else if(NguyenCungChanh=='n')
break;
}
}
void caidat()
{

system("cls");
while (1)
{
printf("\t\t \n");
printf("\t\t |CHAO MUNG BAN DEN VOI UNG DUNG QUAN LY THU
VIEN BANG C++|\n");
printf("\t\t | |\n");
printf("\t\t | |\n");
printf("\t\t | CO 2 CACH DE BAN VAO MENU
CHINH |\n");
printf("\t\t | |\n");
printf("\t\t | CACH 1 : NHAN PHIM 1 DE CAI DAT NHANH VAO
MENU |\n");
printf("\t\t | CACH 2 : NHAN PHIM 2 DE CAI DAT TUNG BUOC
VAO |\n");
printf("\t\t | |\n");
printf("\t\t | |\n");
printf("\t\t | NHAN PHIM 0 VA ENTER 2 LAN DE THOAT
NHANH |\n");
printf("\t\t | |\n");
printf("\t\t | |\n");
printf("\t\t | NGUYEN CUNG CHANH |\n");
printf("\t\t | TM05A3 |\n");
printf("\t\t | 12310433 |\n");
printf("\t\t | |\n");
printf("\t\t | |\n");
printf("\t\t | DOC KY HUONG DAN TRUOC KHI SU
DUNG |\n");
printf("\t\t | |\n");
printf("\t\t \n");

printf("\t\t MOI BAN NHAP SO DE CAI DAT HOAC THOAT CHUONG
TRINH :");
int t;
scanf("%d",&t);
if (t==0)
break;
else if(t==1)
menu();
else if(t==2)
caidatcham();
}
}
void main()
{
system("cls");
caidatcham();
getch();
}
Bài 2 Quản Lý karaook bằng Danh Sách Liệt Kê
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream>
struct karaook
{
char mp[10], makh[10],tenkhach[30];
int v, r, tt;
struct karaook *next;
};
karaook *head;

// Ham Nay Minh Cung Cho Cau lenh Bao minh biet phai nhap gi vao >>>>
void nhap()
{
system("cls");
int i = 0;
head = NULL;
karaook *tail;
char mp[10];
while (1)
{
fflush(stdin);
printf("\t\t > >\n");
printf("\t\t >- KHONG MUON NHAP NUA THU NHAN ENTER
NHE ->\n");
printf("\t\t > >\n");
printf("\t\t NHAP THONG THIN PHONG THU NHAT %d\n", +
+i);
printf("\n Nhap Ma Phong :\t");
gets(mp);
if (strcmp (mp, "\0") == 0)
break;
if (head == NULL)
{
head = new karaook;
tail = head;
}
else
{
tail->next = new karaook;
tail = tail->next;

}
char makh[10], tenkhach[30];
int v, r, tt;
printf("\n Nhap Ma Khach :\t");
gets (makh);
printf("\n Nhap Ten Khach Hang :\t");
gets(tenkhach);
printf("\n Nhap Gio Vao :\t");
scanf("%d", &v);
printf("\n Nhap Gio Ra :\t");
scanf("%d",&r);
printf("\n Nhap Tong Tien Khach Tra :\t");
scanf("%d",&tt);
strcpy (tail->mp, mp);
strcpy (tail->makh, makh);
strcpy (tail->tenkhach, tenkhach);
tail->v = v;
tail->r = r;
tail->tt = tt;
tail->next = NULL;
}
printf("\n\t\t > >\n");
printf("\t\t>- NHAN ENTER DE VAO LAI MENU BAN VUA VAO
->\n");
printf("\t\t > >\n");
getch();
}
// Ham Xuat Nay Minh Da lam Tieu De cho no nen Viet Print Hoi Nhieu
void print()
{

system("cls");
int i=0;
karaook *p = head;
while (p!=NULL)
{
printf("\n\t\t\t\tKHACH HANG THU >>===>\t%d",++i);
printf("\n\t\t####################################################");
printf("\n\t\tMa Phong :\t");
printf("%s",p->mp);
printf("\n\t\t# #");
printf("\n\t\tMa Khach Hang :\t");
printf("%s",p->makh);
printf("\n\t\t# #");
printf("\n\t\tTen Khach Hang :\t");
printf("%s",p->tenkhach);
printf("\n\t\t# #");
printf("\n\t\tGio Vao :\t");
printf("%d",p->v);
printf("\n\t\t# #");
printf("\n\t\tGio Ra :\t");
printf("%d",p->r);
printf("\n\t\t# #");
printf("\n\t\tTong Tien :\t");
printf("%d",p->tt);
printf("\n\t\t####################################################");
p = p->next ;
}
printf("\n\t\t > >\n");
printf("\t\t>- NHAN ENTER DE VAO LAI MENU BAN VUA VAO
->\n");

printf("\t\t > >\n");
getch();
}
void gan (karaook *p, karaook *q)
{
strcpy (p->mp, q->mp);
strcpy (p->makh, q->makh);
strcpy (p->tenkhach, q->tenkhach);
p->v = q->v;
p->r = q->r;
p->tt = q->tt;
}
void tang()
{
for (karaook *p = head; p->next != NULL; p = p->next)
{
karaook *m = p;
for (karaook *q = p->next ; q != NULL; q= q->next )
if (m->tt < q->tt)
m = q;
karaook *t = new karaook;
gan (t, m);
gan (m, p);
gan (p, t);
}
print();
getch();
}
void wap (karaook *p, karaook *q)
{

strcpy (p->mp, q->mp);
strcpy (p->makh, q->makh);
strcpy (p->tenkhach, q->tenkhach);
p->v = q->v;
p->r = q->r;
p->tt = q->tt;
}
void giam()
{
for (karaook *p = head; p->next != NULL; p = p->next)
{
karaook *m = p;
for (karaook *q = p->next ; q != NULL; q= q->next )
if (m->tt > q->tt)
m = q;
karaook *t = new karaook;
wap (t, m);
wap (m, p);
wap (p, t);
}
print();
getch();
}
//######################################################################
#################################################################
//######################################################################
#################################################################
// menu sap xep
void sapxep()
{

while(1)
{
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++\n");
printf("\t\t + C0 CU SAP XEP TANG <=>GIAM +\n");
printf("\t\t + + Z.TANG DAN THE0 T0NG TIEN +\n");
printf("\t\t + + Y.GIAM DAN THE0 T0NG TIEN +\n");
printf("\t\t + + X.QUAY LAI MENU +\n");
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++
++\n");
printf("\t\t >>====>\t M0I CHON NHAP Z H0AC Y:\t");
char HocCHoCoAiCungDuocThi;
scanf("%s",&HocCHoCoAiCungDuocThi);
if (HocCHoCoAiCungDuocThi=='z')
tang();
else if (HocCHoCoAiCungDuocThi=='y')
giam();
else if (HocCHoCoAiCungDuocThi='x')
break;
}
}
void lonhon()
{
system("cls");
int x;
int i=0;
printf(">>===>NHAP SO TIEN DE LIET KE CHI TIET KHACH HANG
CO SO TIEN > HON:");
scanf("%d",&x);
for (karaook *p=head;p != NULL;p = p->next )

if ( p->tt >x )
{
printf("\n\t\t\t\tKHACH HANG THU >>===>\t%d",++i);
printf("\n\t\t>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<")
;
printf("\n\t\tMa Phong :\t");
printf("%s",p->mp);
printf("\n\t\t| |");
printf("\n\t\t\tMa Khach Hang :\t");
printf("%s",p->makh);
printf("\n\t\t| |");
printf("\n\t\tTen Khach Hang :\t");
printf("%s",p->tenkhach);
printf("\n\t\t| |");
printf("\n\t\tGio Vao :\t");
printf("%d",p->v);
printf("\n\t\t| |");
printf("\n\t\tGio Ra :\t");
printf("%d",p->r);
printf("\n\t\t| |");
printf("\n\t\tTong Tien :\t");
printf("%d",p->tt);
printf("\n\t\t>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<");
}
printf("\n\t\t > >\n");
printf("\t\t>- NHAN ENTER DE VAO LAI MENU BAN VUA VAO
->\n");
printf("\t\t > >\n");
getch();
}

void nhohon()
{
system("cls");
int x;
int i=0;
printf(">>===>NHAP SO TIEN DE LIET KE CHI TIET KHACH HANG
CO SO TIEN < HON:");
scanf("%d",&x);
for (karaook *p=head;p != NULL;p = p->next )
if ( p->tt <x )
{
printf("\n\t\t\t\tKHACH HANG THU >>===>\t%d",++i);
printf("\n\t\t#####################################################");
printf("\n\t\tMa Phong :\t");
printf("%s",p->mp);
printf("\n\t\t# #");
printf("\n\t\tMa Khach Hang :\t");
printf("%s",p->makh);
printf("\n\t\t# #");
printf("\n\t\tTen Khach Hang :\t");
printf("%s",p->tenkhach);
printf("\n\t\t# #");
printf("\n\t\tGio Vao :\t");
printf("%d",p->v);
printf("\n\t\t# #");
printf("\n\t\tGio Ra :\t");
printf("%d",p->r);
printf("\n\t\t# #");
printf("\n\t\tTong Tien :\t");
printf("%d",p->tt);

printf("\n\t\t#####################################################");
}
printf("\n\t\t > >\n");
printf("\t\t>- NHAN ENTER DE VAO LAI MENU BAN VUA VAO
->\n");
printf("\t\t > >\n");
getch();
}
void lietke()
{
system("cls");
while (1)
{
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("\t\t + MENU LIET KE +\n");
printf("\t\t + 1.LIET KE KHACH CO TONG TIEN > HON +\n");
printf("\t\t + 2.LIET KE KHACH CO TONG TIEN < HON +\n");
printf("\t\t + 0.TH0AT KH0I MENU LIET KE +\n");
printf("\t\t ++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("\t\t >>====> \tNHAP SO :\t");
int k;
scanf("%d",&k);
if(k==0)
break;
else if(k==1)
lonhon();
else if(k==2)
nhohon();
}
}

void them()
{
system("cls");
printf("\t\tNHAP TH0NG TIN THE0 G0I Y DE CH0 VA0 DANH SACH
\n");
printf("\t\t \n");
char mp[10], makh[10],tenkhach[30];
int v, r, tt;
fflush(stdin);
printf("\nNhap Ma Phong Can Them :\t");
gets (mp);
printf("\nNhap Ma Khach Hang Can Them :\t");
gets (makh);
printf("\nNhap Ma Ten Khach Hang Can Them :\t");
gets (tenkhach);
printf("\nNhap Gio Va0 Cua Khach Hang Can Them :\t");
scanf("%d", &v);
printf("\nNhap Gio Ra Cua Khach Hang Can Them :\t");
scanf("%d", &r);
printf("\nNhap Tong Tien Cua Khach Hang Can Them :\t");
scanf("%d", &tt);
karaook *p = new karaook;
strcpy (p->mp, mp);
strcpy (p->makh, makh);
strcpy (p->tenkhach, tenkhach);
p->v = v;
p->r = r;
p->tt =tt;
karaook *q = head;
while (q->next != NULL)

q = q->next ;
q->next = p;
p->next = NULL;
print();
getch();
}
void xoa()
{
system("cls");
printf("\t\t >=========>>==========>>=========>>=========>>\n");
printf("\t\t >=====>>NHAP MA PHONG BAN CAN XOA<<=======<");
char mp[10];
fflush (stdin);
gets (mp);
karaook *p, *q;
if (strcmp (head->mp , mp) == 0)
{
p = head;
head = head->next;
delete p;
}
else
{
p = head;
while (p != NULL)
{
if (strcmp (p->mp, mp ) == 0)
break;
q = p;
p = p->next;

}
if (p!= NULL)
{
q->next = p->next;
delete p;
}
}
print();
getch();
}
void suane()
{

×