Question: 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++

  1. id (integer) - identifies the element
  2. texture (string) - specifies the appearance of the element (rabbit, fox, etc.)
  3. color (integer)
  4. health (double)
  5. Dimensions length, width, and height. All three values are doubles (these variables will be also stored in struct "dimension" )
  6. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!