HTML Code Programming Assignment help

computer science

Description

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;


Related Questions in computer science category