#Issue with “playlist” linked list output

11 messages · Page 1 of 1 (latest)

tribal needle
#

there is another .h and .cpp file that’s connected here but I do not want to put anyone through that suffering so here I will send the important parts.

The image at the bottom displays the “error” within my code. I think I can solve it with an if statement but I’m not sure where I would put it? Any help is appreciated.

SongNode.cpp

void SongNode::PrintSongInfo(){
   cout << "Title: " << this->songTitle << endl;
   cout << "Length: " << this->songLength << endl;
   cout << "Artist: " << this->songArtist << endl << endl;
}

main.cpp

    // Print linked list
    cout << "LIST OF SONGS" << endl;
    cout << "-------------" << endl;
    PrintPlaylist(headNode);
    
    return 0;
}

restive gyroBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

primal pecan
#

D: your output has an extra newline ^^

tribal needle
primal pecan
#

D: you need a newline between the songs, but not after the last one

tribal needle
#

It’s 12am I’m losing it

primal pecan
#

D: if you see that the current node is the last, do not put a newline ^^

spiral pulsar
#

You need to move printing the new lines to a place where you iterate over the list, not inside printing a specific element

restive gyroBOT
#

This question is being automatically marked as stale.
If your question has been answered, type !solved.
If your question is not answered feel free to bump the post or re-ask.
Take a look at !howto ask for tips on improving your question.

tribal needle
#

!solved