Project 9 S Code Requestc Include Include Include Include Include Requesth Include Readlin Q37198864

Project 10, Program Design 1. (70 points) Modify project 9 by adding and modifying the following functions 1) Add a delete fu

Project 9’s Code
request.c

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <ctype.h>

#include “request.h”

#include “readline.h”

struct request *append_to_list(struct request *list){

int room_number;

printf(“Enter room number: “);

scanf(“%d”, &room_number);

while (getchar() != ‘n’);

struct request *ptr = list;

if(list != NULL) {

do {

if(ptr->room_number == room_number) {

printf(“A request for this room already exists.n”);

printf(“Please use update function to update therequest.n”);

return list;

}

if(ptr->next != NULL) {

ptr = ptr->next;

}

} while(ptr->next != NULL);

}

struct request *newReq = malloc(sizeof(struct request));

newReq->room_number = room_number;

printf(“Enter first name: “);

read_line(newReq->first, NAME_LEN);

printf(“Enter last name: “);

read_line(newReq->last, NAME_LEN);

printf(“Enter number of items: “);

scanf(“%d”, &newReq->num_items);

while (getchar() !=

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.