Complete and submit Programming Exercise #1 listed on Page 858, Chapter 17 of your textbook. Use of C compiler and submission of compiled version of your C program is required to receive credits.
Submit a screenshot of the executed program and the code of the program.
This is what I have written so far and keep getting errors.
#include
#include
#include /* has the malloc prototype */
#include /* has the strcpy prototype */
#define TSIZE 45 /* size of array to hold title */
struct film {
char title[TSIZE];
int rating;
struct film * next; /* points to next struct in list */
};
char* s_gets(char * st, int n);
int main(void)
{
struct film * head = NULL;
struct film * prev, *current;
char input[TSIZE];
/* Gather and store information */
puts("Enter first movie title:");
while (s_gets(input,TSIZE) != NULL && input[0] != '');
{
current = (struct film *) malloc(sizeof(struct film));
if (head == NULL) /* first structure */
head = current;
else /* subsequent structures */
prev->next = current;
current->next = NULL;
strcpy_s(current->title, input);
puts("Enter your rating :");
scanf_s("%d", ¤t->rating);
while (getchar() != 'n')
continue;
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |