Esempio n. 1
0
// asgdsgsg
song_node * find_artist(char artist[]){
	song_node *temp = table[artist[0]-97];
	temp = find_artist(artist);
	print_list(temp);
	return temp;

}
Esempio n. 2
0
void print_artist(char artist[]){
	printf("%s list:\n", artist);
	song_node *temp = find_artist(artist);
	while (temp && strncmp(artist, temp->artist, 1) == 0){
		if (strcmp(temp->artist, artist) == 0){
			printf("*%s - %s\n", temp->artist, temp->song);
		}
		temp = temp->next;
	}
	printf("\n");

}
Esempio n. 3
0
int main() {
	node* table[26];
	int c = 0;
	while(c < 26) {
		table[c] = 0;
		c++;
	}
	srand(time(NULL));
	printf("List function testing\n\n");
	node *list = (node *)malloc(sizeof(node));
	strcpy(list->name,"singing in the rain");
	strcpy(list->artist,"john");
	list->next = NULL;
	insert_lexic(list, "tomato sauce", "joshua");
	insert_lexic(list, "potatoes", "joshua");
	insert_lexic(list, "quiet", "joshua");
	printf("List length (after adding 4 nodes in order): %d\n\n", list_len(list));
	printf("Print list:\n");
	print_list(list);
	printf("\nFind song (quiet):\n");
	print_list(find_song(list, "quiet"));
	printf("\nFind artist (joshua):\n");
	print_list(find_artist(list, "joshua"));
	printf("\nRandom Nodes:\n");
	print_list(randomn(list));
	print_list(randomn(list));
	print_list(randomn(list));
	print_list(randomn(list));
	printf("\nSpecific Library Functions:\nAdding 5 songs:\n");
	add_song(table, "hello", "john");
	add_song(table, "goodbye", "james");
	add_song(table, "fish", "john");
	add_song(table, "star", "patrick");
	add_song(table, "jean-luc", "picard");
	printf("\nPrint letter function:\n");
	print_let(table, 'p');
	printf("\nPrint library function:\n");
	print_lib(table);
	printf("\nPrint artist (john) function:\n");
	print_art(table, "john");
	del_song(findlib_song(table, "hello"), table);
	printf("Deleted hello by john\n");
	print_art(table, "john");
	printf("\nShuffle List (6 songs):\n");
	shuffle(table, 6);
	printf("\nDelete library:\n");
	del_lib(table);
	print_lib(table);
	return 0;
}
Esempio n. 4
0
File: main.c Progetto: mks65/tunez
int main() {
  srand((unsigned) time(NULL));
  
  printf("LIBRARY\n");
  printf("=======\n");
  add_song(table, "hello", "adele");
  add_song(table, "arabella", "arctic monkeys");
  add_song(table, "formation", "beyonce");
  add_song(table, "sorry", "beyonce");
  add_song(table, "cardiac arrest", "bad suns");
  add_song(table, "summer", "calvin harris");
  add_song(table, "closer", "the chainsmokers");
  print_library(table);
  printf("\n");
  
  printf("searching for \'closer - the chainsmokers\'\n");
  printf("===========================================\n");
  song_node *findSong = find_song(table, "closer", "the chainsmokers");
  if (findSong) printf("found %s - %s\n", findSong->name, findSong->artist);
  printf("\n");
  
  printf("searching for \'kids - mgmt\'\n");
  printf("=============================\n");
  song_node *findSong2 = find_song(table, "kids", "mgmt");
  if (findSong2) printf("found %s - %s\n", findSong2->name, findSong2->artist);
  printf("\n");
    
  printf("searching for adele\n");
  printf("===================\n");
  song_node *findArtist = find_artist(table, "adele");
  if (findArtist) print_list(findArtist);
  printf("\n");
  
  printf("searching for akmu\n");
  printf("===================\n");
  song_node *findArtist2 = find_artist(table, "akmu");
  if (findSong2) print_list(findArtist2);
  printf("\n");
  
  printf("print \'b\'\n");
  printf("===========\n");
  print_letter(table, "b");
  printf("\n");
  
  printf("print beyonce\n");
  printf("=============\n");
  print_artist(table, "beyonce");
  printf("\n");
  
  printf("print entire library\n");
  printf("====================\n");
  print_library(table);
  printf("\n");
  
  printf("shuffle and list three songs\n");
  printf("============================\n");
  shuffle(table, 3);
  printf("\n");
  
  printf("deleting a song\n");
  printf("===============\n");
  printf("deleting \'summer - calvin harris\'\n");
  delete_song(table, "summer", "calvin harris");
  print_library(table);
  printf("\n");
  
  printf("deleting everything (FAULTY)\n");
  printf("============================\n");
  delete_all(table);
  print_library(table);
}