Download as pdf
Download as pdf
You are on page 1of 5
Total marks = 20 Deadline | Semester: Spring 2024 29" of April 2024 refull the folk Don't copy-paste the same answer. Make sure you can make some changes to your solution file before submitting copy paste solution will be marked zero. Ifyou found any mistake then correct yourself and inform me. Before submitting an Assignment GDB checks your assignment requirement file. For any query, feel free to Contact at WhatsA pp: +923074960034 Provide by MJUNAID QAZI Code: #include +#include using namespace std class Task { public: string description; Task(const string& description) : description( description) {} CONTACT ON WHATSAPP +923074960034 string getDescription() const { return description (const string& description) { this->description = description; class Node { public: Task task; Node* next; Node(const Taské& task) : task(task), next(NULL) {} class List { private: Node* head; public. List() :head(NULL) {} void addTask(constTask& task) { Node* newNode = new Node(task); newNode->next = head; head = newNode; CONTACT ON WHATSAPP +923074960034 void displayTasks() const { Node* current = head; int count = 0; cout << "== Display Tasks (BCX: while (current != NULL) { cout << count <<", " << current->task.getDeseription() << endl; current = current->next, counth+; "Total Tasks entered: "<< count << endl; void removeTask(const string& description) { Node* current = head: Node* previous = NULL; while (current != NULL) { if (current->task. getDescription() = description) | if (previous != NULL) { previous->next = current->next; } oboe ( head = current->next; } delete current; return; } previous = current; current = current->next; CONTACT ON WHATSAPP +923074960034 cout << "Task \"" << description <<"\" not found." << endl: int main() { List taskList; taskList.addTask(Task("Task 1")); taskList.addTask(Task("Task 2")); taskList.addTask(Task("Task 3")); taskList.addTask(Task(""Task 4")); taskList.addTask(Task("Task 5"); taskList displayTasks(); taskList.removeTask("Task 3"); taskList.removeTask("Task 5"); taskList.displayTasks(); return 0; CONTACT ON WHATSAPP +923074960034 Wish you the very best of Luck!

You might also like