Check Explanation and attachment.
Explanation:
Since the site does not allow me to submit my work(for you to easily copy and paste it), I will post some additional attachments.
Please, note that there is category, unique ID, description for each media item.
#include <stdio.h>
#include <string.h>
struct Media {
int id;
int year;
char title[250];
char description[250];
char category[50];
};
void show_menu();
void add_item(struct Media arr[], int *c);
void print_all(struct Media arr[], int c);
void print_category(struct Media arr[], int c);
void delete_entry(struct Media arr[], int *c);
int main() {
struct Media collection[100];
int ch, count = 0;
// loop until user wants to quit
while (1) {
show_menu(); // display the menu
printf("Enter your choice: ");
scanf("%d", &ch);
if (ch == 1)
add_item(collection, &count);
else if (ch == 2)
print_all(collection, count);
else if (ch == 3)
print_category(collection, count);
else if (ch == 4)
delete_entry(collection, &count);
else if (ch == 0)
break;
else
printf("Invalid choice. Try again!\n");
}
return 0;
}
void show_menu() {
printf("1. Add a media item to the collection\n");
printf("2. Print all media in the collection\n");
printf("3. Print all media in a given category\n");
printf("4. Delete an entry\n");
printf("0. Quit\n");
}
void add_item(struct Media arr[], int *cnt) {