so this sounds great, it allows me to add a song, but how does it fit in
Code:
bool BobCatPod::addSong(Song t)
{
if (isfull ())
{
return false;
}
SongNode *newSong = new SongNode; //a new node
// Allocate a new node and stor num there.
newSong->s = t;
head = newSong;
newSong->next = NULL;
return true;
usedMemory++;
}
I mean I would do then
Code:
BobCatPod::BobCatPod()
int totalMemory = 0;
int usedMemory = 0;
totalMemory - usedMemory = remainingMemory;
bool BobCatPod::isfull ()
{
if (remainingMemory > MAX_MEMORY)
{
return true;
}
}
then would I
Code:
bool BobCatPod::addSong(Song t)
{
if (isfull ())
{
return false;
}
s.push_front(t);
return true;
usedMemory++;
}
?? I am not in data structures yet this is only my second c++ class.