You will use a struct called Card to model a single card. This struct will contain a data member to store name of the ca

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

You will use a struct called Card to model a single card. This struct will contain a data member to store name of the ca

Post by answerhappygod »

You will use a struct called Card to model a single
card. This struct will contain a data member to
store name of the card (of type string) and another
data member to store its energy (of type int). Card
names can only be single words (no spaces in the name; this is an
assumption). If you want, you can write constructor(s) for this
struct, but that is not needed for the main program. However, you
will not write any member functions for this struct.
The deck of cards will be implemented as a class
named Deck. In the Deck class, there should be two
private data members: (i) the cards inside the deck as a dynamic
array of Card struct (i.e. Card pointer); (ii)
the size of this dynamic array, i.e. the number of cards in
the Deck object. It is a must to use such a
class structure with a dynamic array of struct in the homework; you
cannot use any other data structure.
In the remainder of the document, we will be referring to the
beginning and end of the deck with the terms “top” and
“bottom”. The top of the deck is the beginning of it, i.e. it is
the 0th element in the Card array, and the bottom of
the deck is the last element of the Card array.
"=" This operator will be overloaded such that
it will assign the Deck object on the right hand-side of the
operator to the Deck object on the left-hand side. This function
must be implemented in a way to allow cascaded assignments. Due to
C++ language rules, this operator must be a member function (cannot
be free function). ( I NEED THE ANSWER FOR THIS
PART)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply