Guest User

Untitled

a guest
Jul 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. /* okay here is the first attempt at this code
  2. to generate a deck of cards that has the
  3. attributes of a standard deck. Next trick is
  4. to get it to randomly choose a number
  5. and suite
  6. class standards are
  7. -implement a deck class that represents a deck of 52 cards
  8. -public interface should include methods to shuffle
  9. deal
  10. display hands
  11. do a pair-wise comparision of cards (e.g a queen beats a jack
  12. -to simulate shuffling use a random number generator*/
  13.  
  14. #include <iostream>
  15. #include "card.h"
  16. using std :: cout;
  17. using std :: endl;
  18.  
  19. card ::gen_card()
  20. {
  21. public:
  22. int s = suit; //suite i.e club, spade, etc
  23. int f = face ; //2-10, Ace King Quenn, Jack
  24.  
  25. card.suite = rand*4;
  26. card.face = rand*13;
  27.  
  28. }
  29.  
  30. suite get_suite() { return card_suite; }
  31.  
  32. enum suite { diamond, heart, spade, club };
  33. enum face { two, three, four, five, six, seven, eight, nine,
  34. ten, jack, queen, king, ace };
  35.  
  36. class card deck [52]
  37. {
  38. bool exists [4] [13];
  39. suite = suite_value;
  40. face = face_value;
  41.  
  42. for (int x=0; x<4; x++)
  43. for (int x=0: y<13; y++)
  44. EXISTS [x] [y]=FALSE;
  45.  
  46. for (int I = 0; I<52; I++)
  47. }
  48. DO
  49. {
  50. deck[I].gen_card.suite_value = rand*4 + diamond;
  51. face_value = rand*13+two;
  52. deck[I].get_suite()
  53. }
  54. UNTIL (!EXISTS [suite_value] [face_value]);
  55. EXISTS [suite_value] [face_value] = TRUE;
  56. deck[I].set_face (face_value);
  57. deck[I].set_suite(suite_value);
  58.  
  59. }
Add Comment
Please, Sign In to add comment