Ejemplo n.º 1
0
void ResistorList::insert_resistor_at_end()
{
    Resistor *ptr = NULL;
    Resistor *temp;
    for(ptr = head; ptr !=NULL; ptr = ptr->get_resistor_next())
    {
    }
    ptr->set_next_resistor(temp);
    temp->set_next_resistor(NULL);
}
Ejemplo n.º 2
0
// Returns the resistor that has the given name.
// Puts the previous resistor in "previous". Puts NULL in "previous" if the
// given name is the first resistor in the list.
Resistor* ResistorList::find_resistor(string name, Resistor*& previous)
{
    Resistor *ptr = NULL;
    previous = NULL;
    for(ptr = head; ptr !=NULL; ptr = ptr->get_resistor_next())
    {
        if(name == ptr->getName())
        {
            return ptr;
        
        }
        previous = ptr;
    }
    return NULL;
}