So I have part of my code done and I'm stuck on how to sort structures.
This is the code i have until now.
Its supposed to ask the user 3 things title, artist name, rating of song
and im supposed to ask the user to sort them in certain order
so its supposed to look something like this on the bottom
"Select the operation to perform -- (t)itle, (a)rtist, (r)ating, (f)ilter, (q)uit"
and its supposed to sort however the user prompts it to
#include <stdio.h>
#include <stdlib.h>
struct playlist
{
int rating;
char title[80];
char artist[60];
};
int main (void)
{
struct playlist list1;
int numOfSongs, i;
printf("Enter the # of songs to be entered: ");
scanf("%d", &numOfSongs);
printf("Enter song info in this order <Title, Artist, Rating>: ");
for (i = 0; i < numOfSongs; i++)
{
scanf("%s%s%d", &list1.title, &list1.artist, &list1.rating);
if (i%3)
{
printf("Enter the next song info in this order <Title, Artist, Rating>: ");
scanf("%s%s%d", &list1.title, &list1.artist, &list1.rating);
}
}
}