Advertisement
pichumy

Untitled

Jan 27th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include "Deck.h"
  4.  
  5. Deck::Deck()
  6. {
  7. cards.reserve(52);
  8. for(int i=0; i<52; i++)
  9. {
  10. cards.push_back(Card(i%4, i%13+1));
  11. }
  12.  
  13. }
  14.  
  15. int Deck::get_num_cards()
  16. {
  17. return cards.size;
  18. }
  19.  
  20. int Deck::get_card(int index)
  21. {
  22. return &cards[index]
  23. }
  24.  
  25. int Deck::find_index(int suit, int value) const
  26. {
  27. while(int i=0 < 52)
  28. {
  29. if((cards[i].value==value) && (cards[i].suit == suit)) return i;
  30. i++;
  31. }
  32.  
  33. return -1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement