Question: ser Defined Functions: //pre: requires cstdlib. Should have seeded srand prior to call. // FACE should be a string of characters representing the abbreviated //

ser Defined Functions:

//pre: requires cstdlib. Should have seeded srand prior to call.

// FACE should be a string of characters representing the abbreviated

// face value of a standard playing cards.

// SUIT should be a string of characters representing the abbreviated

// suit value of a standard playing cards.

// Neither FACE nor SUIT can be an empty string.

// FACE defaults to: 23456789TJQKA

// SUIT defaults to: CDHS

//post: will return a string of 2 characters that represent a standard

// playing card. FACE[n] + SUIT[n]

// if FACE or SUIT is empty, a division by zero error will be thrown.

string randomCard(const string& FACE = "23456789TJQKA", const string& SUIT = "CDHS");

std::string randomCard(const std::string& FACE = "23456789TJQKA", const std::string& SUIT = "CDHS")

{

return FACE.substr(rand() % 14, 1) + SUIT.substr(rand() % 4, 1);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!