Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <time.h>
  4. #include "Classes.h"
  5. using namespace std;
  6.  
  7. //cards declarations
  8. int face, suit;
  9. static string faces[14] = {"One", "Two", "Three", "Four", "Five", "Six", "Seven",
  10. "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"};
  11. static string suits[4] = {"Clubs", "Spades", "Diamonds", "Hearts"};
  12.  
  13. //deckofcards declarations
  14. vector<Cards>deck;
  15. int currentCard = -1;
  16.  
  17. //cards functions
  18. int Card::cards(int aFace, int aSuit)
  19. {
  20. face = aFace;
  21. suit = aSuit;
  22. }
  23.  
  24. string Card::toString()
  25. {
  26. return(faces[face] + " of " + suits[suit]);
  27. }
  28. // end cards functions
  29.  
  30. //deckofcards functions
  31.  
  32. DeckOfCards::DeckOfCards()
  33. {
  34. for(int i = 0; i < 13; i++);
  35. {
  36. for(int j = 0; j < 4; j++);
  37. {
  38. deck.push_back(Cards(i, j));
  39. }
  40. }
  41. }
  42.  
  43. void DeckOfCards::shuffle()
  44. {
  45. srand (time(NULL));
  46. rand (deck.begin(), deck.end());
  47. }
  48.  
  49. Card DeckOfCards::dealCard()
  50. {
  51. currentCard++;
  52. return deck.at(currentCard);
  53. }
  54.  
  55. bool DeckOfCards::moreCards()
  56. {
  57. if(currentCard < 52)
  58. {
  59. return true;
  60. }
  61. else
  62. {
  63. return false;
  64. }
  65. }
  66.  
  67. //end deckofcards functions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement