Home / Expert Answers / Computer Science / this-is-in-c-language-please-i-only-need-help-with-the-functions-create-monster-print-monster-s-pa701

(Solved): This is in C language please, I only need help with the functions: create monster print monster s ...



This is in C language please, I only need help with the functions:

create monster

print monster

save monster

and load monster

The rest I have ready to go.

Create a struct that contains the following fields:
- (a array of size 32)
- type (a char array of size 16)
- hp (an int)
- \

Create a struct that contains the following fields: - (a array of size 32) - type (a char array of size 16) - hp (an int) - int) This should be defined in a header file called Make sure you include a header guard. implement a function named create_monster that prompts the user to enter the values for each field of the struct monster. The function should returna object. Additionally, create a function called print_monster that takes a as a parameter and prints the data in the following format: Name: name Type: type HP: hp Level: level Include the declarations for these functions in Create a third file named test_add_monster.c that includes_and tests your and function. (25\%) Problem 2 Now that the is defined and we can add new entries in memory, we need to be able to save the data to a file. Create a function named save_monster that takes a struct monster and a FILE pointer as parameters. The function should write the monster as binary data. You can assume that the given FILE pointer is already open for writing. Define this function in and include the declaration in Create a third file named that includes and tests your function by creating a monster with and saving it to a file. Make sure to open the file in append mode so that new entries will save to the end of the file. (25\%) Problem 3 The next step is to load the data from the file into memory. Create a function named load_monster that takes a fILE pointer as a parameter. The function should read the next line from the file and return a struct monster object. You can assume that the given FILE pointer is already open for reading. Since this data is stored in a binary file, you will need to use the fread function to load the data. Since the data was written in the same order that it was read, you can use the same fread calls to load the data into a array. You can assume that the file contains less than 128 monster objects. We will also need a way to display the data after loading. Create a function named print that takes an array of struct monster objects and the number of elements in the array as parameters. It should print a table of the data in the following format: Create a file named test_load_monsters.c that includes and tests your and print_monsters functions by loading the data from the file and printing it to the screen.


We have an Answer from Expert

View Expert Answer

Expert Answer


implementation of the functions you described in C language:In the header file "monster.h":#ifndef MONSTER_H#define MONSTER_H#define MAX_NAME_SIZE 32#
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe