Homework/HW02/List.cc
int List::positionAtNode(ListIterator target)
{
    ListIterator currentNode = head;
    int currentPosition = 0, foundPosition = -1;

    //Verify that the target is not NULL and the list is not empty because if either is then there
    //is no need to search.
    if (target && currentNode)
    {
        //Iterate through the list in search of the target.
        while (foundPosition == -1 && currentNode)
        {
            //Check to see if the current node is the target node.
            if (currentNode == target)
                foundPosition = currentPosition;

            //If it is not, move to the next node and increment the position counter.
            else
            {
                ++currentPosition;
                ++currentNode;
            }
        }
    }

    return foundPosition;
}
/****************************** List::positionAtNode ***********************************************
Action:         Searches for a given ListIterator in a list.  Returns -1 if the ListIterator is not
                in the list for any reason, including if the list is empty, the ListIterator being
                searched for is NULL, or it simply isn't in the list.

Parameters:
IN:             ListIterator target, contains the node being looked for by this function.
OUT:            None

Returns:        int, containing the zero-based element number of found node.  If not found, will be
                -1.

Precondition:   None
***************************************************************************************************/
:positionAtNode
Action:         Searches for a given ListIterator in a list.  Returns -1 if the ListIterator is not
in the list for any reason, including if the list is empty, the ListIterator being
searched for is NULL, or it simply isn't in the list.

ListIterator target, contains the node being looked for by this function.
OUT:            None

int, containing the zero-based element number of found node.  If not found, will be
1.

None
: positionAtNode Action : Searches for a given ListIterator in a list . Returns - 1 if the ListIterator is not in the list for any reason including if the list is empty the ListIterator being searched for is NULL or it simply isn ' t in the list . ListIterator target contains the node being looked for by this function . OUT : None int containing the zero - based element number of found node . If not found will be 1 . None
int List::positionAtNode(ListIterator target)
{
    ListIterator currentNode = head;
    int currentPosition = 0, foundPosition = -1;
    if (target && currentNode)
    {
        while (foundPosition == -1 && currentNode)
        {
            if (currentNode == target)
                foundPosition = currentPosition;
            else
            {
                ++currentPosition;
                ++currentNode;
            }
        }
    }
    return foundPosition;
}
int List :: positionAtNode ( ListIterator target ) { ListIterator currentNode = head ; int currentPosition = 0 , foundPosition = -1 ; if ( target && currentNode ) { while ( foundPosition == -1 && currentNode ) { if ( currentNode == target ) foundPosition = currentPosition ; else { ++ currentPosition ; ++ currentNode ; } } } return foundPosition ; }
List::positionAtNode
Action:         Searches for a given ListIterator in a list.
List :: positionAtNode Action : Searches for a given ListIterator in a list .
//Verify that the target is not NULL and the list is not empty because if either is then there //is no need to search. //Iterate through the list in search of the target. //Check to see if the current node is the target node. //If it is not, move to the next node and increment the position counter.