Straight Linked List Implementation
void Node::Pop()
{
Node * temp, * temp1;
temp=this->GetNext();
temp1=temp->GetNext();
this->SetNext(temp1);
temp->SetNext(0);
delete temp;
return;
}
void Node::Top()
{
cout <<"This Cat's Age is "<< this->GetNext()->GetCat()->GetAge()<< endl;
}
bool Node::IsADTEmpty()
{
if (HowManyNodes<.5)
return 1;
else
return 0;
}
void Node::Display()
{
int i;
// If the Cat exists, display it
if (itsCat->GetAge()ɬ)
{
cout << "My cat is ";
cout << itsCat->GetAge() << " years old\n";
cin >> i;
}
// Increment the list and try again
if (itsNext)
{
itsNext->Display();
}
}
Previous slide
Next slide
Back to first slide
View graphic version