SlideShare a Scribd company logo
1 of 3
Download to read offline
8.16 LAB: Playlist (output linked list)
**Hey I have most of this done I just need to figure out to get rid of the indent/whitespace for this
Given main(), complete the SongNode class to include the function PrintSongInfo(). Then write the
PrintPlaylist() function in main.cpp to print all songs in the playlist. DO NOT print the dummy
head node.
Ex: If the input is:
the output is:
main.cpp
#include "SongNode.h"
void PrintPlaylist(SongNode* head) {
SongNode* temp = head->GetNext();
while (temp != nullptr) {
temp->PrintSongInfo();
temp = temp->GetNext();
}
}
int main() {
SongNode* headNode = new SongNode();
SongNode* currNode = nullptr;
SongNode* lastNode = headNode;
string songTitle;
string songLength;
string songArtist;
getline(cin, songTitle);
while (songTitle != "-1") {
getline(cin, songLength);
getline(cin, songArtist);
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode->InsertAfter(currNode);
lastNode = currNode;
getline(cin, songTitle);
}
cout << "LIST OF SONGS" << endl;
cout << "-------------" << endl;
PrintPlaylist(headNode);
return 0;
}
SongNode.h
#include<iostream>
#include<string>
using namespace std;
class SongNode {
private:
string songTitle;
string songLength;
string songArtist;
SongNode* nextNodeRef;
public:
SongNode();
SongNode(string songTitleInit, string songLengthInit, string songArtistInit);
SongNode(string songTitleInit, string songLengthInit, string songArtistInit, SongNode* nextLoc);
void InsertAfter(SongNode* nodeLoc);
SongNode* GetNext();
void PrintSongInfo();
};
SongNode.cpp
#include "SongNode.h"
SongNode::SongNode() {
songTitle = "";
songLength = "";
songArtist = "";
nextNodeRef = nullptr;
}
SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit) {
songTitle = songTitleInit;
songLength = songLengthInit;
songArtist = songArtistInit;
nextNodeRef = nullptr;
}
SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit, SongNode*
nextLoc) {
songTitle = songTitleInit;
songLength = songLengthInit;
songArtist = songArtistInit;
nextNodeRef = nextLoc;
}
void SongNode::InsertAfter(SongNode* nodeLoc) {
SongNode* tmpNext = nextNodeRef;
nextNodeRef = nodeLoc;
nodeLoc->nextNodeRef = tmpNext;
}
SongNode* SongNode::GetNext() {
return nextNodeRef;
}
void SongNode::PrintSongInfo() {
cout << "Title: " << songTitle << endl;
cout << "Length: " << songLength << endl;
cout << "Artist: " << songArtist << endl << endl;
}
zyBooks My library > CS 1119: Computer Programming With C++ home > 8.16: LAB: Playlist
(output linked list) zyBooks catalog ? Help/FAQ 8 Julia Fritsch I.TST OF SONC5 --itle: Stomp! Iitht
380 Length: Artiat: The Brothera Johnson Title: The Iude Length: 337 Artist: Quincy Jones Title:
You Don't Own Me Length: 151 Artist: Lesley Gore + LIsT of SoNCs -------- Title: Stome! Length:
380 Artist: The Brothers Johnson Title: The Dude Length: 337 Artist: Quincy Jones Title: You Don't
Own Me Artiat: Lesley Gore Expected cutput Title: The Dude

More Related Content

Similar to 816 LAB Playlist output linked list Hey I have most of.pdf

8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf
8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf
8.8 Program Playlist (Java)You will be building a linked list. Ma.pdfARCHANASTOREKOTA
 
Can someone please help me complete the add_song function .pdf
Can someone please help me complete the add_song function .pdfCan someone please help me complete the add_song function .pdf
Can someone please help me complete the add_song function .pdfakshpatil4
 
Program 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdfProgram 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdfaddtechglobalmarketi
 
I am having the below compile errors. .pdf
I am having the below compile errors. .pdfI am having the below compile errors. .pdf
I am having the below compile errors. .pdfdbrienmhompsonkath75
 
Given main(), complete the SongNode class to include the printSong.pdf
Given main(), complete the SongNode class to include the printSong.pdfGiven main(), complete the SongNode class to include the printSong.pdf
Given main(), complete the SongNode class to include the printSong.pdfillyasraja7
 
Can someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdfCan someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdfakshpatil4
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdffantoosh1
 
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdfarenamobiles123
 
PFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfPFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfmailadmin1
 
Can someone solve the TODO parts of the following problem i.pdf
Can someone solve the TODO parts of the following problem i.pdfCan someone solve the TODO parts of the following problem i.pdf
Can someone solve the TODO parts of the following problem i.pdfakshpatil4
 
lab03build.bat@echo offclsset DRIVE_LETTER=1set.docx
lab03build.bat@echo offclsset DRIVE_LETTER=1set.docxlab03build.bat@echo offclsset DRIVE_LETTER=1set.docx
lab03build.bat@echo offclsset DRIVE_LETTER=1set.docxDIPESH30
 
I need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdfI need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdfarihanthtextiles
 
Problem 2 struct to hold information about a song struct So.pdf
 Problem 2 struct to hold information about a song struct So.pdf Problem 2 struct to hold information about a song struct So.pdf
Problem 2 struct to hold information about a song struct So.pdfahujaelectronics175
 
Please solve the TODO parts of the following probelm incl.pdf
Please solve the TODO parts of the following probelm  incl.pdfPlease solve the TODO parts of the following probelm  incl.pdf
Please solve the TODO parts of the following probelm incl.pdfaggarwalopticalsco
 
Need help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docxNeed help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docxJason0x0Scottw
 
PLEASE I need help with my assignment I have to compelet .pdf
PLEASE I need help with my assignment I have to compelet  .pdfPLEASE I need help with my assignment I have to compelet  .pdf
PLEASE I need help with my assignment I have to compelet .pdfankit11134
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxDIPESH30
 
819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdfmeenaaarika
 

Similar to 816 LAB Playlist output linked list Hey I have most of.pdf (20)

8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf
8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf
8.8 Program Playlist (Java)You will be building a linked list. Ma.pdf
 
Can someone please help me complete the add_song function .pdf
Can someone please help me complete the add_song function .pdfCan someone please help me complete the add_song function .pdf
Can someone please help me complete the add_song function .pdf
 
Program 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdfProgram 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdf
 
I am having the below compile errors. .pdf
I am having the below compile errors. .pdfI am having the below compile errors. .pdf
I am having the below compile errors. .pdf
 
Given main(), complete the SongNode class to include the printSong.pdf
Given main(), complete the SongNode class to include the printSong.pdfGiven main(), complete the SongNode class to include the printSong.pdf
Given main(), complete the SongNode class to include the printSong.pdf
 
Can someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdfCan someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdf
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
 
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
 
PFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfPFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdf
 
Can someone solve the TODO parts of the following problem i.pdf
Can someone solve the TODO parts of the following problem i.pdfCan someone solve the TODO parts of the following problem i.pdf
Can someone solve the TODO parts of the following problem i.pdf
 
lab03build.bat@echo offclsset DRIVE_LETTER=1set.docx
lab03build.bat@echo offclsset DRIVE_LETTER=1set.docxlab03build.bat@echo offclsset DRIVE_LETTER=1set.docx
lab03build.bat@echo offclsset DRIVE_LETTER=1set.docx
 
I need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdfI need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdf
 
Problem 2 struct to hold information about a song struct So.pdf
 Problem 2 struct to hold information about a song struct So.pdf Problem 2 struct to hold information about a song struct So.pdf
Problem 2 struct to hold information about a song struct So.pdf
 
week-13x
week-13xweek-13x
week-13x
 
Please solve the TODO parts of the following probelm incl.pdf
Please solve the TODO parts of the following probelm  incl.pdfPlease solve the TODO parts of the following probelm  incl.pdf
Please solve the TODO parts of the following probelm incl.pdf
 
Need help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docxNeed help getting past an error in C++! I have all my code pasted down.docx
Need help getting past an error in C++! I have all my code pasted down.docx
 
PLEASE I need help with my assignment I have to compelet .pdf
PLEASE I need help with my assignment I have to compelet  .pdfPLEASE I need help with my assignment I have to compelet  .pdf
PLEASE I need help with my assignment I have to compelet .pdf
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
 
819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf
 

More from sastaindin

A 7 year 15000 bond paying a coupon rate of 475 compound.pdf
A 7 year 15000 bond paying a coupon rate of 475 compound.pdfA 7 year 15000 bond paying a coupon rate of 475 compound.pdf
A 7 year 15000 bond paying a coupon rate of 475 compound.pdfsastaindin
 
A 25 yearold graduate student enters the student health ce.pdf
A 25 yearold graduate student enters the student health ce.pdfA 25 yearold graduate student enters the student health ce.pdf
A 25 yearold graduate student enters the student health ce.pdfsastaindin
 
a 2 pts Construct the final Fibonacci heap after the fol.pdf
a 2 pts Construct the final Fibonacci heap after the fol.pdfa 2 pts Construct the final Fibonacci heap after the fol.pdf
a 2 pts Construct the final Fibonacci heap after the fol.pdfsastaindin
 
A 2010 Pew Research poll asked 1306 Americans From what yo.pdf
A 2010 Pew Research poll asked 1306 Americans From what yo.pdfA 2010 Pew Research poll asked 1306 Americans From what yo.pdf
A 2010 Pew Research poll asked 1306 Americans From what yo.pdfsastaindin
 
a 1 The first step is to understand the requirements of th.pdf
a 1 The first step is to understand the requirements of th.pdfa 1 The first step is to understand the requirements of th.pdf
a 1 The first step is to understand the requirements of th.pdfsastaindin
 
A 10 year old develops severe pharyngitis at summer camp He.pdf
A 10 year old develops severe pharyngitis at summer camp He.pdfA 10 year old develops severe pharyngitis at summer camp He.pdf
A 10 year old develops severe pharyngitis at summer camp He.pdfsastaindin
 
A modeling study of the stomatogastric ganglion STG of th.pdf
A  modeling study of the stomatogastric ganglion STG of th.pdfA  modeling study of the stomatogastric ganglion STG of th.pdf
A modeling study of the stomatogastric ganglion STG of th.pdfsastaindin
 
9 Using the key choices complete the crossword puzale by a.pdf
9 Using the key choices complete the crossword puzale by a.pdf9 Using the key choices complete the crossword puzale by a.pdf
9 Using the key choices complete the crossword puzale by a.pdfsastaindin
 
9 Sickle Cell Anemia is a condition that shows codominance.pdf
9 Sickle Cell Anemia is a condition that shows codominance.pdf9 Sickle Cell Anemia is a condition that shows codominance.pdf
9 Sickle Cell Anemia is a condition that shows codominance.pdfsastaindin
 
A Blastula aamas B zigot aamas C Morula aamas D.pdf
A  Blastula aamas   B  zigot aamas   C  Morula aamas   D.pdfA  Blastula aamas   B  zigot aamas   C  Morula aamas   D.pdf
A Blastula aamas B zigot aamas C Morula aamas D.pdfsastaindin
 
97 Using the table for the t distributions make an assess.pdf
97 Using the table for the t distributions make an assess.pdf97 Using the table for the t distributions make an assess.pdf
97 Using the table for the t distributions make an assess.pdfsastaindin
 
925 Match the following generally accepted accounting princ.pdf
925 Match the following generally accepted accounting princ.pdf925 Match the following generally accepted accounting princ.pdf
925 Match the following generally accepted accounting princ.pdfsastaindin
 
8En Alemania los trabajadores Seleccione uno a pued.pdf
8En Alemania los trabajadores    Seleccione uno  a pued.pdf8En Alemania los trabajadores    Seleccione uno  a pued.pdf
8En Alemania los trabajadores Seleccione uno a pued.pdfsastaindin
 
9Tara asiste a una escuela secundaria en un rea urbana Q.pdf
9Tara asiste a una escuela secundaria en un rea urbana Q.pdf9Tara asiste a una escuela secundaria en un rea urbana Q.pdf
9Tara asiste a una escuela secundaria en un rea urbana Q.pdfsastaindin
 
918 LAB Sorting user IDs Given a main that reads user ID.pdf
918 LAB Sorting user IDs Given a main that reads user ID.pdf918 LAB Sorting user IDs Given a main that reads user ID.pdf
918 LAB Sorting user IDs Given a main that reads user ID.pdfsastaindin
 
900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf
900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf
900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdfsastaindin
 
9 You are studying the molecular behavior of myosin II S1 .pdf
9 You are studying the molecular behavior of myosin II S1 .pdf9 You are studying the molecular behavior of myosin II S1 .pdf
9 You are studying the molecular behavior of myosin II S1 .pdfsastaindin
 
9 What will be the outgut of the C program Aincluderstdich.pdf
9 What will be the outgut of the C program Aincluderstdich.pdf9 What will be the outgut of the C program Aincluderstdich.pdf
9 What will be the outgut of the C program Aincluderstdich.pdfsastaindin
 
9 Which Git command should be used to update a local reposi.pdf
9 Which Git command should be used to update a local reposi.pdf9 Which Git command should be used to update a local reposi.pdf
9 Which Git command should be used to update a local reposi.pdfsastaindin
 
9 Private solutions to correct for externalities Consider t.pdf
9 Private solutions to correct for externalities Consider t.pdf9 Private solutions to correct for externalities Consider t.pdf
9 Private solutions to correct for externalities Consider t.pdfsastaindin
 

More from sastaindin (20)

A 7 year 15000 bond paying a coupon rate of 475 compound.pdf
A 7 year 15000 bond paying a coupon rate of 475 compound.pdfA 7 year 15000 bond paying a coupon rate of 475 compound.pdf
A 7 year 15000 bond paying a coupon rate of 475 compound.pdf
 
A 25 yearold graduate student enters the student health ce.pdf
A 25 yearold graduate student enters the student health ce.pdfA 25 yearold graduate student enters the student health ce.pdf
A 25 yearold graduate student enters the student health ce.pdf
 
a 2 pts Construct the final Fibonacci heap after the fol.pdf
a 2 pts Construct the final Fibonacci heap after the fol.pdfa 2 pts Construct the final Fibonacci heap after the fol.pdf
a 2 pts Construct the final Fibonacci heap after the fol.pdf
 
A 2010 Pew Research poll asked 1306 Americans From what yo.pdf
A 2010 Pew Research poll asked 1306 Americans From what yo.pdfA 2010 Pew Research poll asked 1306 Americans From what yo.pdf
A 2010 Pew Research poll asked 1306 Americans From what yo.pdf
 
a 1 The first step is to understand the requirements of th.pdf
a 1 The first step is to understand the requirements of th.pdfa 1 The first step is to understand the requirements of th.pdf
a 1 The first step is to understand the requirements of th.pdf
 
A 10 year old develops severe pharyngitis at summer camp He.pdf
A 10 year old develops severe pharyngitis at summer camp He.pdfA 10 year old develops severe pharyngitis at summer camp He.pdf
A 10 year old develops severe pharyngitis at summer camp He.pdf
 
A modeling study of the stomatogastric ganglion STG of th.pdf
A  modeling study of the stomatogastric ganglion STG of th.pdfA  modeling study of the stomatogastric ganglion STG of th.pdf
A modeling study of the stomatogastric ganglion STG of th.pdf
 
9 Using the key choices complete the crossword puzale by a.pdf
9 Using the key choices complete the crossword puzale by a.pdf9 Using the key choices complete the crossword puzale by a.pdf
9 Using the key choices complete the crossword puzale by a.pdf
 
9 Sickle Cell Anemia is a condition that shows codominance.pdf
9 Sickle Cell Anemia is a condition that shows codominance.pdf9 Sickle Cell Anemia is a condition that shows codominance.pdf
9 Sickle Cell Anemia is a condition that shows codominance.pdf
 
A Blastula aamas B zigot aamas C Morula aamas D.pdf
A  Blastula aamas   B  zigot aamas   C  Morula aamas   D.pdfA  Blastula aamas   B  zigot aamas   C  Morula aamas   D.pdf
A Blastula aamas B zigot aamas C Morula aamas D.pdf
 
97 Using the table for the t distributions make an assess.pdf
97 Using the table for the t distributions make an assess.pdf97 Using the table for the t distributions make an assess.pdf
97 Using the table for the t distributions make an assess.pdf
 
925 Match the following generally accepted accounting princ.pdf
925 Match the following generally accepted accounting princ.pdf925 Match the following generally accepted accounting princ.pdf
925 Match the following generally accepted accounting princ.pdf
 
8En Alemania los trabajadores Seleccione uno a pued.pdf
8En Alemania los trabajadores    Seleccione uno  a pued.pdf8En Alemania los trabajadores    Seleccione uno  a pued.pdf
8En Alemania los trabajadores Seleccione uno a pued.pdf
 
9Tara asiste a una escuela secundaria en un rea urbana Q.pdf
9Tara asiste a una escuela secundaria en un rea urbana Q.pdf9Tara asiste a una escuela secundaria en un rea urbana Q.pdf
9Tara asiste a una escuela secundaria en un rea urbana Q.pdf
 
918 LAB Sorting user IDs Given a main that reads user ID.pdf
918 LAB Sorting user IDs Given a main that reads user ID.pdf918 LAB Sorting user IDs Given a main that reads user ID.pdf
918 LAB Sorting user IDs Given a main that reads user ID.pdf
 
900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf
900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf
900 ABDli yetikinden oluan bir rneklemde 206s nllerin .pdf
 
9 You are studying the molecular behavior of myosin II S1 .pdf
9 You are studying the molecular behavior of myosin II S1 .pdf9 You are studying the molecular behavior of myosin II S1 .pdf
9 You are studying the molecular behavior of myosin II S1 .pdf
 
9 What will be the outgut of the C program Aincluderstdich.pdf
9 What will be the outgut of the C program Aincluderstdich.pdf9 What will be the outgut of the C program Aincluderstdich.pdf
9 What will be the outgut of the C program Aincluderstdich.pdf
 
9 Which Git command should be used to update a local reposi.pdf
9 Which Git command should be used to update a local reposi.pdf9 Which Git command should be used to update a local reposi.pdf
9 Which Git command should be used to update a local reposi.pdf
 
9 Private solutions to correct for externalities Consider t.pdf
9 Private solutions to correct for externalities Consider t.pdf9 Private solutions to correct for externalities Consider t.pdf
9 Private solutions to correct for externalities Consider t.pdf
 

Recently uploaded

How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 

816 LAB Playlist output linked list Hey I have most of.pdf

  • 1. 8.16 LAB: Playlist (output linked list) **Hey I have most of this done I just need to figure out to get rid of the indent/whitespace for this Given main(), complete the SongNode class to include the function PrintSongInfo(). Then write the PrintPlaylist() function in main.cpp to print all songs in the playlist. DO NOT print the dummy head node. Ex: If the input is: the output is: main.cpp #include "SongNode.h" void PrintPlaylist(SongNode* head) { SongNode* temp = head->GetNext(); while (temp != nullptr) { temp->PrintSongInfo(); temp = temp->GetNext(); } } int main() { SongNode* headNode = new SongNode(); SongNode* currNode = nullptr; SongNode* lastNode = headNode; string songTitle; string songLength; string songArtist; getline(cin, songTitle); while (songTitle != "-1") { getline(cin, songLength); getline(cin, songArtist); currNode = new SongNode(songTitle, songLength, songArtist); lastNode->InsertAfter(currNode); lastNode = currNode; getline(cin, songTitle); } cout << "LIST OF SONGS" << endl; cout << "-------------" << endl; PrintPlaylist(headNode); return 0; } SongNode.h #include<iostream> #include<string> using namespace std; class SongNode {
  • 2. private: string songTitle; string songLength; string songArtist; SongNode* nextNodeRef; public: SongNode(); SongNode(string songTitleInit, string songLengthInit, string songArtistInit); SongNode(string songTitleInit, string songLengthInit, string songArtistInit, SongNode* nextLoc); void InsertAfter(SongNode* nodeLoc); SongNode* GetNext(); void PrintSongInfo(); }; SongNode.cpp #include "SongNode.h" SongNode::SongNode() { songTitle = ""; songLength = ""; songArtist = ""; nextNodeRef = nullptr; } SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit) { songTitle = songTitleInit; songLength = songLengthInit; songArtist = songArtistInit; nextNodeRef = nullptr; } SongNode::SongNode(string songTitleInit, string songLengthInit, string songArtistInit, SongNode* nextLoc) { songTitle = songTitleInit; songLength = songLengthInit; songArtist = songArtistInit; nextNodeRef = nextLoc; } void SongNode::InsertAfter(SongNode* nodeLoc) { SongNode* tmpNext = nextNodeRef; nextNodeRef = nodeLoc; nodeLoc->nextNodeRef = tmpNext; } SongNode* SongNode::GetNext() { return nextNodeRef; }
  • 3. void SongNode::PrintSongInfo() { cout << "Title: " << songTitle << endl; cout << "Length: " << songLength << endl; cout << "Artist: " << songArtist << endl << endl; } zyBooks My library > CS 1119: Computer Programming With C++ home > 8.16: LAB: Playlist (output linked list) zyBooks catalog ? Help/FAQ 8 Julia Fritsch I.TST OF SONC5 --itle: Stomp! Iitht 380 Length: Artiat: The Brothera Johnson Title: The Iude Length: 337 Artist: Quincy Jones Title: You Don't Own Me Length: 151 Artist: Lesley Gore + LIsT of SoNCs -------- Title: Stome! Length: 380 Artist: The Brothers Johnson Title: The Dude Length: 337 Artist: Quincy Jones Title: You Don't Own Me Artiat: Lesley Gore Expected cutput Title: The Dude