#define _CRT_SECURE_NO_WARNINGS #include #include #define N 3 struct film { char title[30]; int copies; int year; }; int FindIt(struct film arr[], int size, char name[]) { int i; for (i = 0; i < size; i++) { if (strcmp(arr[i].title, name) == 0) { printf("\nThe '%s' was filmed in the year %d and it is in stock,\nhas %d copies and can be found in drawer number %d, Enjoy!\n\n", name, arr[i].year, arr[i].copies, i); return (i); } else return (-1); } } void main() { struct film arr[N]; char name[30]; int i, location; for (i = 0; i < N; i++) { printf("Enter the name of film #%d: ", i + 1); scanf("%s", arr[i].title); printf("Enter how many copies are in stock? "); scanf("%d", &arr[i].copies); printf("Enter the year of film #%d: ", i + 1); scanf("%d", &arr[i].year); printf("\n"); } printf("Enter the name of the film you are looking for: "); scanf("%s", name); location = FindIt(arr, N, name); if (location == -1) { printf("\n"); printf("%d => Sorry ,we don't have this film\n", location); } }