I am writing a music library program (like I-Tunes) in which I have to input a exe file with commas into a 2D array. After getting rid of the commas, I should be able to list the genres, songs and artists as outputs with a simple switch statement and some functions.
The only problem is, I have no idea on how to get rid of commas within the file and stuff it into a 2D array. Please help !!
I do not have any code so far but here are the requirements:
Your assignment is to create a program that will read a txt file of music and allow the user to see what He/She might have in their list of music.
Hard code your file path for development purpose but ask the user if they want to enter a path or use the default file. The program should read the categories of the listings by reading the first line of the file.
For Example:
Please select from the following list
--------------------------------------------------------
1) Artist
2) Song
3) Genre
4) Exit
If the user selects the Artist, list all the artist only once and allow the user to select the artist
Example:
Artist
----------------------------------------
1) Van Halen
2) Miles Davis
3) Barry Wordsworth & BBC Concert Orchestra
If the user selects 1, show all the Van Halen in the list.
Van Halen Rock
-------------------------------------
The Best Of Van Halen, Vol. I
Van Halen III
Van Halen
If the user selects Genre, show the entire genre List
Please Select a Genre
--------------------------------------
1) Pop
2) Rock
3) Jazz
4) Country
5) Movie Soundtrack
6) ……..
When the user selects a Genre the songs and artist with that Genre will then be listed
Jazz
----------------------------------------------------------------------
Take 5 Buddy Miles
Worlds Aaron Goldberg
Quiet Songs Aisha Duo
At any time in a menu ‘M’ should send the user back to the main menu.
And in the Main menu 4 or ‘E’ to exit
Do the same, use char* version of getline. this would give you a line in a 1D array.
Then take out substrings (seperated by comma), you can do find using the 'C' api's and then put them in a 2D array.
you can declare a 2D array like this"
char **ppline; or may be like this
char *pline[255];
assuming that you have at max 255 lines.