In C++, I need help Below is the definition of a structure that represents a playing card. The suit of the card is repre

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: 899603
Joined: Mon Aug 02, 2021 8:13 am

In C++, I need help Below is the definition of a structure that represents a playing card. The suit of the card is repre

Post by answerhappygod »

In C++, I need help
Below is the definition of a structure that represents a playing
card. The suit of the card is represented using an enum, and the
rank of the card is represented using an integer from 1 to 13,
where 1 is ace, and 11, 12, and 13 are jack, queen, king
respectively.
In the game of blackjack, ranks 2 through 10 count for the
corresponding number of points; jacks, queens, and kings count for
10 points; and an ace counts for 11 points. (In the full rules of
the game, aces can count as 1 or 11 points, but don't worry about
that complexity here.)
Write a function that takes two cards as parameters, and returns
their total points value.
enum { CLUBS, DIAMONDS, HEARTS, SPADES } Suit;
struct Card {
Suit suit;
int rank;
};
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply