Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following struct and procedure are defined. const int SIZE = 5 ; typedef struct awesome _ data _ struct { int data [ SIZE
The following struct and procedure are defined.
const int SIZE ;
typedef struct awesomedatastruct
int data SIZE;
char type;
awesomedata
void
whoami const awesomedata &str awesomedata &str
int i;
for i ; i SIZE; i
strdata i strdata SIZE i ;
str type str type ;
return ;
Q Hand execute the code below using this procedure.
Initialise d data with and d type with x
Initialise d data with and d type with y
awesomedata dx;
awesomedata dy;
whoami d d;
Q Hand execute the code below using this procedure.
Initialise d data with and d type with r
Initialise d data with and d type with z
awesomedata dR;
awesomedata dz
;
whoami d d;
Q Give a single short sentence to describe what the function whoami is doing, and provide
a more appropriate name for it
You are designing a game and you need to implement a data structure to capture the notion of a player.
This data structure should contain the following:
The x and y position of the player
their name
a player identification number;
an array of length resenting power levels of the player
Q Write a data structure named player to encode the information specified for an player.
Q Implement the procedure below, which copies the power levles of the player in the second parameter to the interger array in the first parameter.
void copypowers int powerlevels player & pl
Q Using your player sruct from Q create MAXPLAYERS number of players on the first dotted line. On the second dotted line, for the st player, set the nd value of their power level to be
Dene MAXENEMIES number of enemies using the data structure you've implemented
void dullandduller void
const int MAXENEMIES ;
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