Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C++ Create a class that represents a playing card. The class will contain an

ID: 3807383 • Letter: I

Question

In C++ Create a class that represents a playing card. The class will contain an enumeration type for the suit of the card and an integer for the numerical value of the card. Write a constructor, accessor functions to return strings for these data members, and mutator functions to set their values. Note that you may need to create additional private functions to implement the type conversions for the accessor functions. Include a print function to display the suit and number of a card object. Include a description of each function and its postcondition in the header file. Write a test program that creates a deck, or array, of cards and prints it out.

Explanation / Answer

main.cpp

Edit & Run



card_games.h

  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  
  #include <iostream>  #include "card_games.h"    using std::cin;  using std::cout;  using std::endl;    int main(int argc, char **argv)  {          StudPoker deckF;          cout << deckF.deckFunction() << endl;                                                  return 0;  }    

Edit & Run