Assignment 02 2
Assignment 02 2
Node* head;
int length;
public:
LinkedList();
~LinkedList();
if (head == nullptr)
{
head = newNode;
}
else
{
Node* current = head;
while (current->next != nullptr)
{
current = current->next;
}
current->next = newNode;
}
length++;
}
int main()
{
LinkedList<int> L;
int valueToInsert2;
cout << "Input an integer element to insert at the end: ";
cin >> valueToInsert2;
L.InsertEnd(valueToInsert2);
if (L.Search(searchValue))
{
cout << searchValue << " found in the list." << endl;
}
else
{
cout << searchValue << " not found in the list." << endl;
}
return 0;
}