0% found this document useful (0 votes)
3 views

Assignment

Uploaded by

2n6dhkjm6p
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment

Uploaded by

2n6dhkjm6p
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

University of Management and Technology Lahore

Lab 4
Name: Hamza Iqbal

Roll number : f2023266765

Section : V18

Course Instructor: BILAL HUSSAIN

1. Student Records Linked List


Node Attributes: int studentID, string name, int age, float GPA

Scenario: A linked list of student records, where each node represents a student with their
unique attributes.

Operations:

· - Add Node at Rear: Add a new student to the end of the list.

· - Add Node at Front: Add a new student at the start of the list.

· - Add Node at Specific Position: Insert a new student at a specified position.

· - Search: Look for a student by studentID or name.

· - Delete from Front/Rear: Remove the first or last student from the list.

· - Delete Node at Specific Position: Remove a student at a particular position.

· - Delete All Nodes: Clear all student records from the list.

· - Display: Show all student records in the list.

· - Update: Modify student details based on studentID.

CODE:

#include <iostream>
#include <string>
using namespace std;

class StudentNode {
public:
int studentID;
string name;
int age;
float GPA;
StudentNode* next;

StudentNode(int id, string n, int a, float g) {


studentID = id;
name = n;
age = a;
GPA = g;
next = nullptr;
}
};

class StudentList {
private:
StudentNode* head;

public:
StudentList() {
head = nullptr;
}

void addStudentAtRear(int id, string name, int age, float gpa) {


StudentNode* newStudent = new StudentNode(id, name, age, gpa);
if (head == nullptr) {
head = newStudent;
} else {
StudentNode* temp = head;
while (temp->next != nullptr) {
temp = temp->next;
}
temp->next = newStudent;
}
}

void addStudentAtFront(int id, string name, int age, float gpa) {


StudentNode* newStudent = new StudentNode(id, name, age, gpa);
newStudent->next = head;
head = newStudent;
}

void addStudentAtPosition(int id, string name, int age, float gpa, int position) {
if (position <= 0) {
addStudentAtFront(id, name, age, gpa);
return;
}

StudentNode* newStudent = new StudentNode(id, name, age, gpa);


StudentNode* temp = head;

for (int i = 0; i < position - 1 && temp != nullptr; i++) {


temp = temp->next;
}

if (temp == nullptr) {
addStudentAtRear(id, name, age, gpa);
} else {
newStudent->next = temp->next;
temp->next = newStudent;
}
}

StudentNode* searchStudentByID(int id) {


StudentNode* temp = head;
while (temp != nullptr) {
if (temp->studentID == id) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

StudentNode* searchStudentByName(string name) {


StudentNode* temp = head;
while (temp != nullptr) {
if (temp->name == name) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

void deleteFromFront() {
if (head == nullptr) return;
StudentNode* temp = head;
head = head->next;
delete temp;
}

void deleteFromRear() {
if (head == nullptr) return;
if (head->next == nullptr) {
delete head;
head = nullptr;
return;
}
StudentNode* temp = head;
while (temp->next->next != nullptr) {
temp = temp->next;
}
delete temp->next;
temp->next = nullptr;
}

void deleteAtPosition(int position) {


if (head == nullptr) return;
if (position == 0) {
deleteFromFront();
return;
}
StudentNode* temp = head;
for (int i = 0; i < position - 1 && temp != nullptr; i++) {
temp = temp->next;
}
if (temp == nullptr || temp->next == nullptr) return;
StudentNode* toDelete = temp->next;
temp->next = toDelete->next;
delete toDelete;
}

void deleteAllNodes() {
while (head != nullptr) {
deleteFromFront();
}
}

void displayStudents() {
StudentNode* temp = head;
while (temp != nullptr) {
cout << "StudentID: " << temp->studentID
<< ", Name: " << temp->name
<< ", Age: " << temp->age
<< ", GPA: " << temp->GPA << endl;
temp = temp->next;
}
}

void updateStudent(int id, string name, int age, float gpa) {


StudentNode* student = searchStudentByID(id);
if (student != nullptr) {
student->name = name;
student->age = age;
student->GPA = gpa;
}
}

~StudentList() {
deleteAllNodes();
}
};

int main() {
StudentList studentList;

studentList.addStudentAtRear(1, "hamza", 20, 5.9);


studentList.addStudentAtRear(2, "ahmed", 22, 3.8);
studentList.addStudentAtFront(3, "altaf", 19, 9.2);
studentList.addStudentAtPosition(4, "fakhar", 21, 3.6, 1);

cout << "Student Records:" << endl;


studentList.displayStudents();

cout << "\nUpdating ahmed's details..." << endl;


studentList.updateStudent(2, "ahmed", 23, 3.9);

cout << "\nStudent Records after update:" << endl;


studentList.displayStudents();

cout << "\nDeleting student at position 1..." << endl;


studentList.deleteAtPosition(1);

cout << "\nStudent Records after deletion:" << endl;


studentList.displayStudents();

cout << "\nDeleting all student records..." << endl;


studentList.deleteAllNodes();

cout << "\nStudent Records after deleting all:" << endl;


studentList.displayStudents();

return 0;
}

OUTPUT :

2. Inventory Management Linked List


Node Attributes: int itemID, string itemName, int quantity, float price

Scenario: A linked list representing an inventory system, where each node is an item in stock.

Operations:

· - Add Node at Rear: Add a new item at the end of the list.

· - Add Node at Front: Add a new item at the beginning.

· - Add Node at Specific Position: Insert an item at a specific position in the inventory list.

· - Search: Find an item by itemID or itemName.

· - Delete from Front/Rear: Remove the first or last item in the list.

· - Delete Node at Specific Position: Remove an item from a specific position.

· - Delete All Nodes: Clear all inventory items.

· - Display: Show all inventory items in the list.

· - Update: Modify item details based on itemID.

CODE:

#include <iostream>
#include <string>
using namespace std;

class ItemNode {
public:
int itemID;
string itemName;
int quantity;
float price;
ItemNode* next;

ItemNode(int id, string name, int qty, float pr) {


itemID = id;
itemName = name;
quantity = qty;
price = pr;
next = nullptr;
}
};

class InventoryList {
private:
ItemNode* head;

public:
InventoryList() {
head = nullptr;
}

void addItemAtRear(int id, string name, int qty, float pr) {


ItemNode* newItem = new ItemNode(id, name, qty, pr);
if (head == nullptr) {
head = newItem;
} else {
ItemNode* temp = head;
while (temp->next != nullptr) {
temp = temp->next;
}
temp->next = newItem;
}
}

void addItemAtFront(int id, string name, int qty, float pr) {


ItemNode* newItem = new ItemNode(id, name, qty, pr);
newItem->next = head;
head = newItem;
}

void addItemAtPosition(int id, string name, int qty, float pr, int position) {
if (position <= 0) {
addItemAtFront(id, name, qty, pr);
return;
}

ItemNode* newItem = new ItemNode(id, name, qty, pr);


ItemNode* temp = head;

for (int i = 0; i < position - 1 && temp != nullptr; i++) {


temp = temp->next;
}
if (temp == nullptr) {
addItemAtRear(id, name, qty, pr);
} else {
newItem->next = temp->next;
temp->next = newItem;
}
}

ItemNode* searchItemByID(int id) {


ItemNode* temp = head;
while (temp != nullptr) {
if (temp->itemID == id) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

ItemNode* searchItemByName(string name) {


ItemNode* temp = head;
while (temp != nullptr) {
if (temp->itemName == name) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

void deleteFromFront() {
if (head == nullptr) return;
ItemNode* temp = head;
head = head->next;
delete temp;
}

void deleteFromRear() {
if (head == nullptr) return;
if (head->next == nullptr) {
delete head;
head = nullptr;
return;
}
ItemNode* temp = head;
while (temp->next->next != nullptr) {
temp = temp->next;
}
delete temp->next;
temp->next = nullptr;
}

void deleteAtPosition(int position) {


if (head == nullptr) return;
if (position == 0) {
deleteFromFront();
return;
}
ItemNode* temp = head;
for (int i = 0; i < position - 1 && temp != nullptr; i++) {
temp = temp->next;
}
if (temp == nullptr || temp->next == nullptr) return;
ItemNode* toDelete = temp->next;
temp->next = toDelete->next;
delete toDelete;
}

void deleteAllNodes() {
while (head != nullptr) {
deleteFromFront();
}
}

void displayItems() {
ItemNode* temp = head;
while (temp != nullptr) {
cout << "ItemID: " << temp->itemID
<< ", Name: " << temp->itemName
<< ", Quantity: " << temp->quantity
<< ", Price: " << temp->price << endl;
temp = temp->next;
}
}

void updateItem(int id, string name, int qty, float pr) {


ItemNode* item = searchItemByID(id);
if (item != nullptr) {
item->itemName = name;
item->quantity = qty;
item->price = pr;
}
}

~InventoryList() {
deleteAllNodes();
}
};

int main() {
InventoryList inventory;

inventory.addItemAtRear (1, "personal computer", 5, 999.99);


inventory.addItemAtRear(2, "Mouse", 50, 19.99);
inventory.addItemAtFront(3, "Keyboard", 30, 49.99);
inventory.addItemAtPosition(4, "speakerr", 15, 9.99, 1);

cout << "Inventory Items:" << endl;


inventory.displayItems();

cout << "\nUpdating Mouse details..." << endl;


inventory.updateItem(2, "Wireless Mouse", 45, 29.99);

cout << "\nInventory Items after update:" << endl;


inventory.displayItems();

cout << "\nDeleting item at position 1..." << endl;


inventory.deleteAtPosition(1);

cout << "\nInventory Items after deletion:" << endl;


inventory.displayItems();

cout << "\nDeleting all inventory items..." << endl;


inventory.deleteAllNodes();

cout << "\nInventory Items after deleting all:" << endl;


inventory.displayItems();

return 0;
}
OUTPUT :

3. Library Book List


Node Attributes: int bookID, string title, string author, int yearPublished

Scenario: A linked list of books available in a library.

Operations:

· - Add Node at Rear: Add a new book at the end of the list.

· - Add Node at Front: Add a new book at the start of the list.

· - Add Node at Specific Position: Insert a book at a specified position in the list.

· - Search: Look for a book by bookID or title.

· - Delete from Front/Rear: Remove the first or last book from the list.

· - Delete Node at Specific Position: Delete a book at a specific position.

· - Delete All Nodes: Clear all book records from the list.
· - Display: Show all book records in the list.

· - Update: Modify book details based on bookID.

CODE:

#include <iostream>
#include <string>
using namespace std;

class BookNode {
public:
int bookID;
string title;
string author;
int yearPublished;
BookNode* next;

BookNode(int id, string t, string a, int year) {


bookID = id;
title = t;
author = a;
yearPublished = year;
next = nullptr;
}
};

class Library {
private:
BookNode* head;

public:
Library() {
head = nullptr;
}

void addBookAtRear(int id, string title, string author, int year) {


BookNode* newBook = new BookNode(id, title, author, year);
if (head == nullptr) {
head = newBook;
} else {
BookNode* temp = head;
while (temp->next != nullptr) {
temp = temp->next;
}
temp->next = newBook;
}
}

void addBookAtFront(int id, string title, string author, int year) {


BookNode* newBook = new BookNode(id, title, author, year);
newBook->next = head;
head = newBook;
}

void addBookAtPosition(int id, string title, string author, int year, int position) {
if (position <= 0) {
addBookAtFront(id, title, author, year);
return;
}

BookNode* newBook = new BookNode(id, title, author, year);


BookNode* temp = head;

for (int i = 0; i < position - 1 && temp != nullptr; i++) {


temp = temp->next;
}

if (temp == nullptr) {
addBookAtRear(id, title, author, year);
} else {
newBook->next = temp->next;
temp->next = newBook;
}
}

BookNode* searchBookByID(int id) {


BookNode* temp = head;
while (temp != nullptr) {
if (temp->bookID == id) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

BookNode* searchBookByTitle(string title) {


BookNode* temp = head;
while (temp != nullptr) {
if (temp->title == title) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

void deleteFromFront() {
if (head == nullptr) return;
BookNode* temp = head;
head = head->next;
delete temp;
}

void deleteFromRear() {
if (head == nullptr) return;
if (head->next == nullptr) {
delete head;
head = nullptr;
return;
}
BookNode* temp = head;
while (temp->next->next != nullptr) {
temp = temp->next;
}
delete temp->next;
temp->next = nullptr;
}

void deleteAtPosition(int position) {


if (head == nullptr) return;
if (position == 0) {
deleteFromFront();
return;
}
BookNode* temp = head;
for (int i = 0; i < position - 1 && temp != nullptr; i++) {
temp = temp->next;
}
if (temp == nullptr || temp->next == nullptr) return;
BookNode* toDelete = temp->next;
temp->next = toDelete->next;
delete toDelete;
}

void deleteAllNodes() {
while (head != nullptr) {
deleteFromFront();
}
}

void displayBooks() {
BookNode* temp = head;
while (temp != nullptr) {
cout << "BookID: " << temp->bookID
<< ", Title: " << temp->title
<< ", Author: " << temp->author
<< ", Year Published: " << temp->yearPublished << endl;
temp = temp->next;
}
}

void updateBook(int id, string title, string author, int year) {


BookNode* book = searchBookByID(id);
if (book != nullptr) {
book->title = title;
book->author = author;
book->yearPublished = year;
}
}

~Library() {
deleteAllNodes();
}
};

int main() {
Library library;

library.addBookAtRear(1, "Quran majeed", " God",620);


library.addBookAtRear(2, "1984", "George Orwell", 1949);
library.addBookAtFront(3, "To Kill a Mockingbird", "Harper Lee", 1960);
library.addBookAtPosition(4, "the midnight library", "Aldous Huxley", 1932, 1);

cout << "Library Books:" << endl;


library.displayBooks();

cout << "\nUpdating 1984 details..." << endl;


library.updateBook(2, "Nineteen Eighty-Four", "George Orwell", 1949);

cout << "\nLibrary Books after update:" << endl;


library.displayBooks();

cout << "\nDeleting book at position 1..." << endl;


library.deleteAtPosition(1);

cout << "\nLibrary Books after deletion:" << endl;


library.displayBooks();

cout << "\nDeleting all library books..." << endl;


library.deleteAllNodes();

cout << "\nLibrary Books after deleting all:" << endl;


library.displayBooks();

return 0;

OUTPUT :
4. Employee Directory Linked List
Node Attributes: int employeeID, string name, string department, float salary

Scenario: A linked list for storing employee records in a company.

Operations:

· - Add Node at Rear: Add a new employee record at the end.

· - Add Node at Front: Add a new employee at the beginning of the directory.

· - Add Node at Specific Position: Insert an employee record at a specified position.

· - Search: Search for an employee by employeeID or name.

· - Delete from Front/Rear: Remove the first or last employee in the list.

· - Delete Node at Specific Position: Remove an employee from a particular position.

· - Delete All Nodes: Clear all employee records from the list.

· - Display: Show all employee records in the list.

· - Update: Modify employee details based on employeeID.

CODE:

#include <iostream>
#include <string>
using namespace std;

class EmployeeNode {
public:
int employeeID;
string name;
string department;
float salary;
EmployeeNode* next;

EmployeeNode(int id, string n, string dept, float sal) {


employeeID = id;
name = n;
department = dept;
salary = sal;
next = nullptr;
}
};

class EmployeeDirectory {
private:
EmployeeNode* head;

public:
EmployeeDirectory() {
head = nullptr;
}

void addEmployeeAtRear(int id, string name, string department, float salary) {


EmployeeNode* newEmployee = new EmployeeNode(id, name, department, salary);
if (head == nullptr) {
head = newEmployee;
} else {
EmployeeNode* temp = head;
while (temp->next != nullptr) {
temp = temp->next;
}
temp->next = newEmployee;
}
}

void addEmployeeAtFront(int id, string name, string department, float salary) {


EmployeeNode* newEmployee = new EmployeeNode(id, name, department, salary);
newEmployee->next = head;
head = newEmployee;
}

void addEmployeeAtPosition(int id, string name, string department, float salary, int position) {
if (position <= 0) {
addEmployeeAtFront(id, name, department, salary);
return;
}

EmployeeNode* newEmployee = new EmployeeNode(id, name, department, salary);


EmployeeNode* temp = head;

for (int i = 0; i < position - 1 && temp != nullptr; i++) {


temp = temp->next;
}
if (temp == nullptr) {
addEmployeeAtRear(id, name, department, salary);
} else {
newEmployee->next = temp->next;
temp->next = newEmployee;
}
}

EmployeeNode* searchEmployeeByID(int id) {


EmployeeNode* temp = head;
while (temp != nullptr) {
if (temp->employeeID == id) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

EmployeeNode* searchEmployeeByName(string name) {


EmployeeNode* temp = head;
while (temp != nullptr) {
if (temp->name == name) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

void deleteFromFront() {
if (head == nullptr) return;
EmployeeNode* temp = head;
head = head->next;
delete temp;
}

void deleteFromRear() {
if (head == nullptr) return;
if (head->next == nullptr) {
delete head;
head = nullptr;
return;
}
EmployeeNode* temp = head;
while (temp->next->next != nullptr) {
temp = temp->next;
}
delete temp->next;
temp->next = nullptr;
}

void deleteAtPosition(int position) {


if (head == nullptr) return;
if (position == 0) {
deleteFromFront();
return;
}
EmployeeNode* temp = head;
for (int i = 0; i < position - 1 && temp != nullptr; i++) {
temp = temp->next;
}
if (temp == nullptr || temp->next == nullptr) return;
EmployeeNode* toDelete = temp->next;
temp->next = toDelete->next;
delete toDelete;
}

void deleteAllNodes() {
while (head != nullptr) {
deleteFromFront();
}
}

void displayEmployees() {
EmployeeNode* temp = head;
while (temp != nullptr) {
cout << "EmployeeID: " << temp->employeeID
<< ", Name: " << temp->name
<< ", Department: " << temp->department
<< ", Salary: " << temp->salary << endl;
temp = temp->next;
}
}

void updateEmployee(int id, string name, string department, float salary) {


EmployeeNode* employee = searchEmployeeByID(id);
if (employee != nullptr) {
employee->name = name;
employee->department = department;
employee->salary = salary;
}
}

~EmployeeDirectory() {
deleteAllNodes();
}
};

int main() {
EmployeeDirectory directory;

directory.addEmployeeAtRear(1, "hamza iqabl", "HR", 60000.0);


directory.addEmployeeAtRear(2, "Muhammad ahmad", "IT", 75000.0);
directory.addEmployeeAtFront(3, "Zeeshan ahmed", "Finance", 50000.0);
directory.addEmployeeAtPosition(4, "Faizan ahmed", "Marketing", 70000.0, 1);

cout << "Employee Directory:" << endl;


directory.displayEmployees();

cout << "\nUpdating Muhammad ahmad's details..." << endl;


directory.updateEmployee(2, "zulzar bhai", "IT", 80000.0);

cout << "\nEmployee Directory after update:" << endl;


directory.displayEmployees();

cout << "\nDeleting employee at position 1..." << endl;


directory.deleteAtPosition(1);

cout << "\nEmployee Directory after deletion:" << endl;


directory.displayEmployees();

cout << "\nDeleting all employee records..." << endl;


directory.deleteAllNodes();

cout << "\nEmployee Directory after deleting all:" << endl;


directory.displayEmployees();

return 0;
}

OUTPUT :
5. Order Tracking Linked List
Node Attributes: int orderID, string customerName, string orderDate, float orderAmount

Scenario: A linked list that tracks orders placed by customers.

Operations:

· - Add Node at Rear: Add a new order to the end of the list.

· - Add Node at Front: Add a new order at the beginning.

· - Add Node at Specific Position: Insert an order at a specific position in the list.

· - Search: Search for an order by orderID or customerName.

· - Delete from Front/Rear: Remove the first or last order from the list.

· - Delete Node at Specific Position: Remove an order from a specified position.

· - Delete All Nodes: Clear all orders from the list.

· - Display: Show all order records in the list.

· - Update: Modify order details based on orderID.

CODE:
#include <iostream>
#include <string>
using namespace std;

class OrderNode {
public:
int orderID;
string customerName;
string orderDate;
float orderAmount;
OrderNode* next;

OrderNode(int id, string name, string date, float amount) {


orderID = id;
customerName = name;
orderDate = date;
orderAmount = amount;
next = nullptr;
}
};

class OrderTracking {
private:
OrderNode* head;

public:
OrderTracking() {
head = nullptr;
}

void addOrderAtRear(int id, string name, string date, float amount) {


OrderNode* newOrder = new OrderNode(id, name, date, amount);
if (head == nullptr) {
head = newOrder;
} else {
OrderNode* temp = head;
while (temp->next != nullptr) {
temp = temp->next;
}
temp->next = newOrder;
}
}
void addOrderAtFront(int id, string name, string date, float amount) {
OrderNode* newOrder = new OrderNode(id, name, date, amount);
newOrder->next = head;
head = newOrder;
}

void addOrderAtPosition(int id, string name, string date, float amount, int position) {
if (position <= 0) {
addOrderAtFront(id, name, date, amount);
return;
}

OrderNode* newOrder = new OrderNode(id, name, date, amount);


OrderNode* temp = head;

for (int i = 0; i < position - 1 && temp != nullptr; i++) {


temp = temp->next;
}

if (temp == nullptr) {
addOrderAtRear(id, name, date, amount);
} else {
newOrder->next = temp->next;
temp->next = newOrder;
}
}

OrderNode* searchOrderByID(int id) {


OrderNode* temp = head;
while (temp != nullptr) {
if (temp->orderID == id) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

OrderNode* searchOrderByCustomerName(string name) {


OrderNode* temp = head;
while (temp != nullptr) {
if (temp->customerName == name) {
return temp;
}
temp = temp->next;
}
return nullptr;
}

void deleteFromFront() {
if (head == nullptr) return;
OrderNode* temp = head;
head = head->next;
delete temp;
}

void deleteFromRear() {
if (head == nullptr) return;
if (head->next == nullptr) {
delete head;
head = nullptr;
return;
}
OrderNode* temp = head;
while (temp->next->next != nullptr) {
temp = temp->next;
}
delete temp->next;
temp->next = nullptr;
}

void deleteAtPosition(int position) {


if (head == nullptr) return;
if (position == 0) {
deleteFromFront();
return;
}
OrderNode* temp = head;
for (int i = 0; i < position - 1 && temp != nullptr; i++) {
temp = temp->next;
}
if (temp == nullptr || temp->next == nullptr) return;
OrderNode* toDelete = temp->next;
temp->next = toDelete->next;
delete toDelete;
}

void deleteAllNodes() {
while (head != nullptr) {
deleteFromFront();
}
}

void displayOrders() {
OrderNode* temp = head;
while (temp != nullptr) {
cout << "OrderID: " << temp->orderID
<< ", Customer Name: " << temp->customerName
<< ", Order Date: " << temp->orderDate
<< ", Order Amount: " << temp->orderAmount << endl;
temp = temp->next;
}
}

void updateOrder(int id, string name, string date, float amount) {


OrderNode* order = searchOrderByID(id);
if (order != nullptr) {
order->customerName = name;
order->orderDate = date;
order->orderAmount = amount;
}
}

~OrderTracking() {
deleteAllNodes();
}
};

int main() {
OrderTracking orders;

orders.addOrderAtRear(101, "Hamza Iqbal", "07-10-2024", 150.75);


orders.addOrderAtRear(102, "Zeeshan ahmed", "12-07-2024", 200.50);
orders.addOrderAtFront(103, "Faheem Afridi", "18-11-2024", 300.00);
orders.addOrderAtPosition(104, "abrahim", "03-4-2024", 250.25, 1);

cout << "Order Tracking List:" << endl;


orders.displayOrders();

cout << "\nUpdating Zeeshan ahmed's order details..." << endl;


orders.updateOrder(102, "mamnoon ali", "05-09-2024", 220.00);
cout << "\nOrder Tracking List after update:" << endl;
orders.displayOrders();

cout << "\nDeleting order at position 1..." << endl;


orders.deleteAtPosition(1);

cout << "\nOrder Tracking List after deletion:" << endl;


orders.displayOrders();

cout << "\nDeleting all order records..." << endl;


orders.deleteAllNodes();

cout << "\nOrder Tracking List after deleting all:" << endl;
orders.displayOrders();

return 0;
}

OUTPUT :

You might also like