vendredi 19 mars 2021

Creating random playlist from .txt [closed]

Hey coders and problem solvers!

So I have a C question in which I have to take data from a text file and create a playlist of random songs from that text file. If anyone wants to challenge themselves and could contribute to helping me in any shape or form it would be much appreciated!

Code Requirements:

  • Use functions where possible.
  • Break your code into independant modules.
  • Sort artists and songs without using "Exchange sort" or "Bubble sort" methods.
  • "Fisher-Yates shuffle" or "Knuth shuffle" are advised.
  • The program should work with any list of artists and songs in the same format.

The input text file contains data in the following format:

Artiste name
Song title***Song duration
Song title***Song duration
...
Song title***Song duration
<blank line>
Artiste name
Song title***Song duration
...

The radomised playlist:

  • Input will be from "artistes+songs.txt"
  • Should not have the same artist 3 times in a row.
  • Should not have more than 3 songs in total.
  • No song can appear 2 times in the playlist.
  • The generated playlist should be as close to 1 hr long as possible (Last song must start on or before 59:59).

The output of the playlist should be in the following format:

Randomised playlist
Artiste name: "Song title" (Song duration)
Artiste name: "Song title" (Song duration)
...
Artiste name: "Song title" (Song duration)
Total duration: (Playlist duration)

Sorry if this seems lazy, i'm a little stuck for time and am pre-emptively asking for help as I start the question.




Aucun commentaire:

Enregistrer un commentaire