int main()
{
    LinkedList TestList;

    TestList.AddNode(-1);
    TestList.AddNode(2);
    TestList.AddNode(0);
    TestList.AddNode(7);

    cout << "Displaying Linked List: " << endl;
    TestList.Display();

    int SearchKey = 2;
    if (TestList.Search(SearchKey) == 0)
        cout << SearchKey << " is in the list." << endl;

    if (TestList.Delete(SearchKey) == 0)
        cout << SearchKey << " was deleted." << endl;

    cout << "Displaying Linked List: " << endl;
    TestList.Display();

    TestList[0] = -122;
    cout << "Displaying Linked List: " << endl;
    for (int i=0; i<TestList.GetCount(); i++)
        cout << TestList[i] << endl;

    return 0;
}
Пример #2
0
void MoveList( LinkedList &list1, LinkedList &list2)
{
	
	
	while( list1.Size() != 0)
	{
		list2.AddNode( list1.Peek());
		
		list1.DeleteNode(list1.Peek());
	}
	
	
}