1 player Black jack for mbed
Dependencies: 4DGL-uLCD-SE PinDetect mbed
card.cpp
- Committer:
- jayvpoddar
- Date:
- 2015-03-12
- Revision:
- 0:d2e6b3ce6988
File content as of revision 0:d2e6b3ce6988:
#include "card.h" Card::Card() { _rank = 0; _suit = 0; } Card::Card(int rank, int suit) { _rank = rank; _suit = suit; } string Card::convertRank() { switch(_rank) { case 0: return "INVALID"; case 1: return "A"; case 2: return "2"; case 3: return "3"; case 4: return "4"; case 5: return "5"; case 6: return "6"; case 7: return "7"; case 8: return "8"; case 9: return "9"; case 10: return "10"; case 11: return "J"; case 12: return "Q"; case 13: return "K"; } } string Card::convertSuit() { switch(_suit) { case 0: return "C"; case 1: return "D"; case 2: return "H"; case 3: return "S"; } } void Card::swapCards(Card cards[] ,int i ,int j) { Card temp =cards[i]; cards[i]=cards[j]; cards[j]=temp; }