Homework/HW02/List.cc
int List::countNegative()
{
    ListIterator currentNode = head;
    int numNegatives = 0;

    //Iterate through the list until the end (NULL) is reached.
    while (currentNode)
    {
        //Compare the value in the current node and see if it is less than 0.
        if (*currentNode < 0)
            //If it is, increment the counter.
            ++numNegatives;

        //Advance to the next node in the list.
        ++currentNode;
    }

    return numNegatives;
}
/****************************** List::countNegative ************************************************
Action:         Counts the number of negative values in the list.  If the list is empty then there
                can not possibly any negative values in it, so this function simply returns 0 in
                that case.

Parameters:
IN:             None
OUT:            None

Returns:        int, containing the number of negative values in the list.

Precondition:   None
***************************************************************************************************/
:countNegative
Action:         Counts the number of negative values in the list.  If the list is empty then there
can not possibly any negative values in it, so this function simply returns 0 in
that case.

None
OUT:            None

int, containing the number of negative values in the list.

None
: countNegative Action : Counts the number of negative values in the list . If the list is empty then there can not possibly any negative values in it so this function simply returns 0 in that case . None OUT : None int containing the number of negative values in the list . None
int List::countNegative()
{
    ListIterator currentNode = head;
    int numNegatives = 0;
    while (currentNode)
    {
        if (*currentNode < 0)
            ++numNegatives;
        ++currentNode;
    }
    return numNegatives;
}
int List :: countNegative ( ) { ListIterator currentNode = head ; int numNegatives = 0 ; while ( currentNode ) { if ( * currentNode < 0 ) ++ numNegatives ; ++ currentNode ; } return numNegatives ; }
List::countNegative
Action:         Counts the number of negative values in the list.
List :: countNegative Action : Counts the number of negative values in the list .
//Iterate through the list until the end (NULL) is reached. //Compare the value in the current node and see if it is less than 0. //If it is, increment the counter. //Advance to the next node in the list.