Code - Nhom 4
Code - Nhom 4
Code - Nhom 4
// Nhom 4
#include<iostream>
#include<string>
#include<iomanip>
struct Hodan
int mh;
string tch;
int stv;
float mtn;
};
struct node
HODAN data;
};
struct list
NODE* pHead;
NODE* pTail;
};
NODE* createNODE(HODAN x)
p->data = x;
p->next = NULL;
p->prev = NULL;
return p;
cout << right << setw(10) << x.mh << setw(30) << x.tch << setw(20) << x.stv << setw(20) << x.mtn <<
endl;
if (l.pHead == NULL)
l.pHead = l.pTail = p;
else
l.pTail->next = p;
l.pTail->prev = p;
l.pTail = p;
void Insert(LIST& l)
HODAN x;
NODE* p = l.pHead;
if (p->data.mh == x.mh)
else
p = p->next;
getline(cin, x.tch);
NODE* k = createNODE(x);
InsertLast(l, k);
{
NODE* p;
if (l.pHead == NULL)
else
if (l.pHead->next == NULL)
p = l.pHead;
delete p;
p = l.pHead;
l.pHead = p->next;
p->next = NULL;
l.pHead->prev = NULL;
delete p;
void DeleteLast(LIST& l)
if (l.pHead == NULL)
{
else
if (l.pHead->next == NULL)
delete l.pTail;
l.pTail = NULL;
else
NODE* p = l.pHead;
p = p->next;
delete p->next;
p->next = NULL;
if (l.pHead->data.mh == x)
DeleteFirst(l);
}
else if (l.pTail->data.mh == x)
DeleteLast(l);
else
NODE* p = l.pHead;
NODE* q = l.pHead;
while (p->data.mh != x)
q = p;
p = p->next;
if (p == NULL)
cout << "\n\n\t\t KHONG TON TAI NODE CAN XOA ";
else
q->next = p->next;
p->next = NULL;
delete p;
string ten;
getline(cin, ten);
cout << "\n\n\t\t ========== DANH SACH HO DAN TIM THEO TEN ========== " << endl;
cout << setw(10) << "MA" << setw(30) << "HO TEN" << setw(20) << "SO THANH VIEN" << setw(20) <<
"THU NHAP" << endl;
if (_strcmpi((char*)ten.c_str(), (char*)tentk.c_str()) == 0)
Output(p->data);
int a;
cin >> a;
cout << "\n\n\t\t ========== DAN SACH HO DAN CO SO DAN CAN TIM ========== " << endl;
cout << setw(10) << "MA" << setw(30) << "HO TEN" << setw(20) << "SO THANH VIEN" << setw(20) <<
"THU NHAP" << endl;
if (k->data.stv == a)
Output(k->data);
int dem = 0;
dem++;
cout << "\n\t So Ho Dan Co Thu Nhap Tren 2TR la: " << dem << endl;
// ========================================= HOAN Vi
==========================================================
HODAN temp = x;
x = y;
y = temp;
}
// ========================================= SAP XEP HO DAN GIAM DAN THEO STV
=================================
cout << "\n\n\t\t ========== DANH SACH CAC HO CO SO THANH VIEN GIAM DAN ========== " <<
endl;
cout << setw(10) << "MA" << setw(30) << "HO TEN" << setw(20) << "SO THANH VIEN" << setw(20) <<
"THU NHAP" << endl;
HoanVi(k->data, h->data);
Output(k->data);
HODAN x;
Insert(l);
SapXep(l);
}
// ================================ TIM KIEM HO DAN CO THU NHAP DUOI 10TR
=====================================
cout << "\n\n\t\t ========== DANH SACH CAC HO CO THU NHAP DUOI 10TR ========== " << endl;
cout << setw(10) << "MA" << setw(30) << "HO TEN" << setw(20) << "SO THANH VIEN" << setw(20) <<
"THU NHAP" << endl;
Output(k->data);
void ShowList(LIST l)
NODE* p = l.pHead;
cout << "\n\n\t\t ========== DANH SACH CAC HO DAN ========== " << endl;
cout << setw(10) << "MA" << setw(30) << "HO TEN" << setw(20) << "SO THANH VIEN" << setw(20) <<
"THU NHAP" << endl;
while (p != NULL)
Output(p->data);
p = p->next;
}
}
void Huy(LIST l)
NODE* p = NULL;
p = l.pHead;
l.pHead = l.pHead->next;
l.pHead->prev = NULL;
delete p;
return;
int luachon;
while (true)
cout << "\n\t\t|| 2.Tim 1 Ho Theo Ten Chu Ho Nhap Vao || ";
cout << "\n\t\t|| 5.Nhap So Thanh Vien. Hien Thi Danh Sach Co So Thanh Vien Do || ";
cout << "\n\t\t|| 6.Dem So Ho Co Muc Thu Nhap Tren 2TR || ";
cout << "\n\t\t|| 7.Sap Xep Danh Sach Giam Dan Theo So Thanh Vien || ";
cout << "\n\t\t|| 8.Them 1 Ho Vao Danh Sach Van Du Dieu Kien Giam Dan Theo So Thanh Vien ||
";
cout << "\n\t\t|| 9.Tim Kiem Danh Sach Cac Ho Co Muc Thu Nhap Tren 10TR || ";
system("cls");
cout << "\n\n\t\t HAY CHON CHUC NANG TREN MAN HINH ";
else if (luachon == 1)
ShowList(l);
else if(luachon == 2)
TimTen(l);
else if (luachon == 3)
Insert(l);
else if (luachon == 4)
{
int x;
cin >> x;
DeleteMA(l,x);
else if (luachon == 5)
Xuat_So_Ho_Co_Thanh_Vien_Nhap_Tu_Ban_Phim(l);
else if (luachon == 6)
Dem(l);
else if (luachon == 7)
SapXep(l);
else if (luachon == 8)
Them_Sap_Xep(l);
else if (luachon == 9)
Tim_Kiem_Ho_Thu_Nhap_10TR(l);
Huy(l);
}
else
break;
int main()
LIST l;
KhoiTao(l);
MENU(l);
system("pause");
return 0;