Untitled
Anonymous
plain_text
05/16/2022 4:09 PM
724 B
19
Indexable
std::string sortedList::printList() const{
std::string print{};
Node* currentNode = first;
if (this->isEmpty()){
print = "NULL.";
} else {
for (int i=0; i<size; i++)
{
if (i==size-1){ //Last iteration
print += std::to_string(currentNode->value) + " -> NULL.";
} else {
print += std::to_string(currentNode->value) + " -> ";
}
currentNode = currentNode->next;
}
}
return print;
} //prints the existing nodesEditor is loading...