-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSong.h
58 lines (46 loc) · 1.37 KB
/
Song.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Group 2
* Last Updated: 25 Apr 20
* COP 3330
* Group Members:
* Amani Muller
* Eric Lampley
* Zahir Cooper
* Claressa Wilson
* */
#ifndef SONG_H
#define SONG_H
#include <iostream>
#include <string>
#include <fstream>
// Song is a simple class that stores a title and artist as strings
// it just provides i/o operators, == operator, constructors and Set function
class Song
{
public:
// output the song in the format:
// title, artist, album, year, length
// output to console
friend std::ostream& operator<<(std::ostream& os, const Song& song);
//output to file
friend std::ofstream& operator<<(std::ofstream& os, const Song& song);
// input the song in the format:
// title, artist, album, year, length
friend std::istream& operator>>(std::istream& is, Song& song);
//input from file
friend std::fstream& operator>>(std::fstream& is, Song& song);
// compare two song objects for equality
friend bool operator==(const Song& lhs, const Song& rhs);
// constructors
Song( );
Song(std::string title, std::string artist, std::string album, int length, int year);
Song(std::string title, std::string artist);
// set the song
void set(std::string title, std::string artist, std::string album, int length, int year);
private:
std::string title;
std::string artist;
std::string album;
int length; // length in seconds
int year;
};
#endif