-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabCycle1-7.h
34 lines (28 loc) · 898 Bytes
/
LabCycle1-7.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <string>
using namespace std;
struct Song {
std::string title;
std::string artist;
int duration;
std::string genre;
Song* next;
Song(const std::string& _title, const std::string& _artist, int _duration, const std::string& _genre)
: title(_title), artist(_artist), duration(_duration), genre(_genre), next(nullptr) {}
};
class Playlist {
private:
Song* head;
public:
Playlist();
~Playlist();
void insertSong(const std::string& title, const std::string& artist, int duration, const std::string& genre);
void displayPlaylist() const;
void sortByTitle();
void sortByArtist();
void sortByDuration();
void sortByGenre();
private:
Song* merge(Song* left, Song* right, const std::string& criteria);
Song* mergeSort(Song* head, const std::string& criteria);
};