How to decalare the structure


Discuss the below:

Q: Suppose I have declared the following struct:

struct Villian {
int wit;
int stealth;
int slainCount;
int slainCap;
string* victimsSlain;
};

Q1. Declare a new Villian called sharpay who has a wit of 24, a stealth of 16, and who has currently claimed three victims: Chad, Troy, and Gabriella. Give sharpay an initial capacity to vanquish 10 victims.

Q2. Write a function called copyVillian that takes two Villian parameters, one called orig and the other called copycat, and makes copycat a deep copy of orig. Hint: a "deep copy" is one that would allow copy to exist completely separately from orig. In other words, they will not share any memory locations.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: How to decalare the structure
Reference No:- TGS01931703

Now Priced at $20 (50% Discount)

Recommended (91%)

Rated (4.3/5)