Untitled
unknown
plain_text
2 years ago
543 B
3
Indexable
Never
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 nodes