Answered step by step
Verified Expert Solution
Link Copied!

Question

00
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++

  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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

How is a futures contract priced?

Answered: 1 week ago