Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <time.h>
- #include "Classes.h"
- using namespace std;
- //cards declarations
- int face, suit;
- static string faces[14] = {"One", "Two", "Three", "Four", "Five", "Six", "Seven",
- "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"};
- static string suits[4] = {"Clubs", "Spades", "Diamonds", "Hearts"};
- //deckofcards declarations
- vector<Cards>deck;
- int currentCard = -1;
- //cards functions
- int Card::cards(int aFace, int aSuit)
- {
- face = aFace;
- suit = aSuit;
- }
- string Card::toString()
- {
- return(faces[face] + " of " + suits[suit]);
- }
- // end cards functions
- //deckofcards functions
- DeckOfCards::DeckOfCards()
- {
- for(int i = 0; i < 13; i++);
- {
- for(int j = 0; j < 4; j++);
- {
- deck.push_back(Cards(i, j));
- }
- }
- }
- void DeckOfCards::shuffle()
- {
- srand (time(NULL));
- rand (deck.begin(), deck.end());
- }
- Card DeckOfCards::dealCard()
- {
- currentCard++;
- return deck.at(currentCard);
- }
- bool DeckOfCards::moreCards()
- {
- if(currentCard < 52)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- //end deckofcards functions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement