Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need to create the following struct in C++ id (integer) - identifies the element texture (string) - specifies the appearance of the element (rabbit,
I need to create the following struct in C++
- id (integer) - identifies the element
- texture (string) - specifies the appearance of the element (rabbit, fox, etc.)
- color (integer)
- health (double)
- Dimensions length, width, and height. All three values are doubles (these variables will be also stored in struct "dimension" )
- Hostile (Boolean) determines if the animal is hostile (1) or peaceful (0)
I need a function (outside the struct) that will read the data and inport from the following txt file into an array. The first line is a number indicating the number of elements in the file.
10 0 rabbit brown 10 .3 .1 .1 0 1 rabbit brown 10 .4 .1 .1 0 2 rabbit grey 10 .2 .1 .1 0 3 deer brown 25 2 .3 .7 0 4 deer brown 25 1.5 3 .9 0 5 fox orange 16 1.1 .2 .4 0 6 fox orange 16 .9 .3 .3 0 7 rat black 9 .2 .1 .05 1 8 rat black 6 .1 .08 .05 1 9 pigeon grey 1 .03 .01 .02 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started