-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsong.h
40 lines (29 loc) · 802 Bytes
/
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
// song.h
#ifndef SONG_H
#define SONG_H
#include <iostream>
using namespace std;
// 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
{
// output the song in the format:
// title, artist
friend ostream& operator<<(ostream& os, const Song& song);
// input the song in the format:
// title, artist
friend istream& operator>>(istream& is, Song& song);
// compare two song objects for equality
friend bool operator==(const Song& lhs, const Song& rhs);
public:
// constructors
Song();
Song(const char* t, const char* a);
// set the song
void Set(const char* t, const char* a);
private:
static const int MAX_CHARS = 64;
char title[MAX_CHARS];
char artist[MAX_CHARS];
};
#endif