#include #include using namespace std; struct Date { int day; int month; int year; }; struct CB { int MS; string HoTenPhiCong; Date ngayBay; int succhua; }; struct NodeCB { CB x; NodeCB* next; }; struct CBlist { NodeCB* head; }; NodeCB* CreatNode(int MS, string hoten, Date ngay, int succhua) { NodeCB* p = new NodeCB; p->x.HoTenPhiCong = hoten; p->x.MS = MS; p->x.ngayBay = ngay; p->x.succhua = succhua; p->next = NULL; return p; } void initialize(CBlist& l) { l.head = NULL; } void AddHead(CBlist& l, NodeCB* x) { if (l.head == NULL) { l.head = x; } else { x->next = l.head; l.head = x; } } void CreateLinkedList(CBlist& l, int n) { int MS, succhua; string hoten; Date ngay; for (int i = 0; i < n;i++){ cout << "Input MSCB: "; cin >> MS; cout << "Nhap ho ten phi cong: "; getline(cin, hoten, '\n'); cout << "Nhap ngay bay: "; cin >> ngay.day >> ngay.month >> ngay.year; cout << "Nhap suc chua: "; cin >> succhua; NodeCB* p = CreatNode(MS, hoten, ngay, succhua); AddHead(l, p); } }