Chapter 13 Exercise Set 1¶
Create files named
Cards.cppto hold the
Cardobject developed in this chapter. In addition to a constructor, be sure to include
equalsfunction from the The equals function section as a free-standing function that takes two
Cards as arguments.
In the version of
Cardintroduced in this chapter, aces are less than deuces (2s). Change this so that aces are ranked higher than Kings, as they are in most card games.
Encapsulate the deck-building code from the Vectors of cards section in a function named
build_deckthat takes no arguments and that returns a fully-populated vector of
to_stringmember function to the
Fractionclass you created in Chapter 12 Exercise Set 1. It should return a string with
numerator/denominatorexcept when the
1, in which case it should return only a string containing the numerator.