nt a flow cgart for this program #include using namespace std; class Song { public: string name; string length; string genre; string artist; public: Song(string name, string length, string artist
i want a flow cgart for this program
#include<bits/stdc++.h>
using namespace std;
class Song {
public:
string name;
string length;
string genre;
string artist;
public:
Song(string name, string length, string artist, string genre) {
this->name = name;
this->length = length;
this->genre = genre;
this->artist = artist;
}
};
void getNextSong(stack<Song*>& st) {
Song * s = st.top();
cout << s->name << endl;
cout << s->length << endl;
cout << s->genre << endl;
cout << s->artist << endl;
}
void deleteSong(stack<Song*>& st) {
st.pop();
cout << endl << "The song has deleted " << endl << endl;
}
int main() {
stack<Song*> st;
st.push(new Song("bad guy", "3:00", "billy elish", "Pop"));
st.push(new Song("I am bad", "3:04", "Micheal Jackson", "Pop"));
st.push(new Song("They dont really care about us", "3:04", "Micheal Jackson", "Pop"));
st.push(new Song("roar ", "3:05", "Shakira", "Pop"));
st.push(new Song("Count on me", "3:04", "Bruno Mars", "Pop"));
getNextSong(st);
deleteSong(st);
getNextSong(st);
return 0;
}
Step by step
Solved in 7 steps with 5 images