Пример #1
0
void shuffle(){
	printf("shuffle \n");
	song_node *temp = 0;
	int i = 0;
	while (i++ < 26){
		song_node *a = table[i];
		while(a){
			temp = add_front(temp, a->song, a->artist);
			a = a->next;
		}
	}
	while (temp){
		song_node *rand = find_random(temp);
		printf("%s - %s\n", rand->artist, rand->song);
		temp = remove_song(temp, rand->song, rand->artist);
	}
  	printf("\n");
}
Пример #2
0
song* remove_song(song*list, char*n, char*a) {
  if (!list){
    return list;
  }
  if ( strcmp(n, list->name) == 0 && strcmp(a, list->artist) == 0 ) {
    song *temp = list->next;
    free(list);
    return temp;
  }
  list->next = remove_song(list->next, n, a);
  return list;
  /*
  while (list){
    if (strcmp(list->artist, a) == 0 && 
	strcmp(list->name, n) == 0){
      song* temp = list->next;
      free(list);
      return list->next;
    }
    list = list->next;
  }
  return list;
  */
}
Пример #3
0
void delete_song(char song[], char artist[]){
	printf("\n deleting %s - %s", artist, song);
	table[artist[0]-97] = remove_song(table[artist[0]-97], song, artist);
	print_library();
}