#define TAM_NAME 50
#define TAM_VECTOR 50
struct song {
char title[TAM_NAME];
char artist[TAM_NAME];
};
void list_all_songs();
void print_song(struct song * m)
void le_input(char * temp);
struct song vec_songs[TAM_VECTOR];
int num_songs=0;
char song_file[] = "songs.txt";
int main() {
char op;
do {
printf("Choose an option among the possibilities:\n");
printf(" [1]List song\n");
printf(" [2]Insert new song\n");
printf(" [L]eave\n");
fflush(stdin);
scanf("%c", &op);
switch (op) {
case '1':
printf("\nmenu 1\n");
list_all_songs();
break;
case '2':
printf("\nmenu 2\n");
read_new_song(&vec_songs[num_songs]);
num_songs++;
break;
case 'l':
case 'L':
break;
default:
//system("cls");
printf("Invalid Option!!!\n");
}
if (op!='l' && op!='L') {
printf("\n\npress any key to return to the menu...\n");
getchar();
}
} while (op!='l' && op!='L');
return 0;
}
直到这里还可以,但是接下来的几行我甚至是最简单的问题
void print_song(struct song * m) {
/*
* TO DO - this function must print the song from the structure- title + artist
*/
}
void le_input(char * time){
char input[TAM_NAME];
/*
* TO DO - this function must read a string written by the user and store it in time
*/
}
void list_all_songs()
{
/*
* TO DO - this function must scroll through the song vector and print its song information
*/
}
我相信从这里开始一切都很好,所以我将删除其余的代码。我只需要那3个帮助之一