I am shuffling songs for my program but im a little confused because when I try the compiler tells me I cant compare my struct to an int. Im wondering what yall might think?
struct Songs //my struct
{
string title;
string artist;
string mem;
};
Songs *ptr;
ptr = new Songs[25]; //dynamic array
so i told u the struct and ptr well heres the function im experiencing trouble..
void shuffle (Songs song[], Songs *ptr, string title, string mem, string artist, int num)
{
for (int i=0; i<(num); i++)
{
int r = i + (rand() % (num-i)); // Random remaining position.
int temp = ptr[i]; ptr[i] = ptr[r]; ptr[r] = temp; //this isnt working
} //but its logically sound?
for (int c=0; c<n; c++)
{
cout << ptr[c] << " "; // Just print
}
}