#include "movies.h" int main(int argc, char** argv) { if(argc < 2) { printf("Please Specify Filename\n"); return 64; } struct node* head = parse_csv(argv[1]); enum OPTIONS menu_select = 0; while(1) { menu_select = menu(); switch(menu_select) { case YEAR: movie_year(head); break; case RATE: movie_rate(head); break; case LANGUAGE: movie_lang(head); break; case EXIT: printf("Goodbye~\n"); return 0; default: printf("You naughty~ Pick a correct option next time.\n"); } } print_movies(head); return 0; } int menu() { printf("1. Show movies released in the specified year\n"); printf("2. Show highest rated movie for each year\n"); printf("3. Show the title and year of release of all movies in a specific language\n"); printf("4. Exit from the program\n\n"); int option; do { option = integer_input("Enter a choice from 1 to 4: "); } while(option > 4 || option < 1); return option; } int year_print(struct csv* data, void* val) { if(data->year != *(int*)val) return 0; printf("%s\n", data->title); return 1; } void movie_year(struct node* head) { void* f = &year_print; int* val = malloc(sizeof(int)); *val = integer_input("Enter year to search movies from: "); iterate_nodes(head, f, val); printf("\n\n"); } void movie_rate(struct node* head) { printf("stub\n"); } void movie_lang(struct node* head) { printf("stub\n"); }