Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve stages 1 , 2 and 3 using C coding language: Stage 1 Define four arrays, two for the database and two for the player's

Solve stages 1,2 and 3 using C coding language:
Stage 1
Define four arrays, two for the database and two for the player's creatures. (the sample file on the course website will
help with this)
Use of a 2-dimensional (2D) array to store the creature names, i.e 2 D creature array -10 rows 21 columns
(21 accounts for null value).
Use of a 2-dimensional (2D) integer array to store creature stats (health and attack) i.e.2D integer array -10
rows 2 columns.
For example (note the use of symbolic constants, i.e., #define MAX_CREATURES 10, etc):
Define a 2D array of creatures to store the creatures' names. For example:
char db_creatures[MAX_CREATURES][STRING_LENGTH]={'\0'};
Define a 2D array of integers to store the creatures' stat information. For example:
int db_stats [MAX_CREATURES][STATS_COUNT]={0};
Stage 2
Write the code for functions read_creature_file() and display_creatures () as specified above. Add code
to call these two functions to ensure they are working correctly. You may write your own read_creature_file()
function or you may use the one provided for you. A sample read_creature_file() function will be posted online
by week 8.
For example, given the provided databaseCreatures. txt file, your array should now look like this:
db_creatures
(2D array of creatures) to store creature names
db_stats
(2D array of integers) to store
stats
Stage 3
Now that you know that the information is being correctly stored in your creature and health arrays, write the code for
function write_to_file(). Add code to call this function to ensure it is working correctly. Your .txt files outputted
should match the same format as the input files.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

Define Decision making

Answered: 1 week ago

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago