I'm trying to make an iterator for the cards vector but it doesn't seem to be working correctly, here's the code:
Code:
void Deal(int howmanycards, vector<Card> hand, vector<int>)
{
deck.cards::iterator it = deck.cards.begin();
for (it; it = deck.cards[howmanycards]; it++)
{
hand.push_back(deck.cards[it]);
deck.cards.erase(it);
}
}
I'm just trying to make a function that will deal cards to a hand, it takes an int for how many cards to draw, a card vector for where to put them, and an int vector to determine if they are face up or face down.
Here are the errors I get.
Code:
------ Build started: Project: Blackjack, Configuration: Debug Win32 ------
Compiling...
Blackjack.cpp
c:\visual studio 2005\projects\blackjack\blackjack\dealer.h(30) : error C2653: 'cards' : is not a class or namespace name
c:\visual studio 2005\projects\blackjack\blackjack\dealer.h(30) : error C2039: 'iterator' : is not a member of 'Deck'
c:\visual studio 2005\projects\blackjack\blackjack\deck.h(19) : see declaration of 'Deck'
c:\visual studio 2005\projects\blackjack\blackjack\dealer.h(30) : error C2146: syntax error : missing ';' before identifier 'it'
c:\visual studio 2005\projects\blackjack\blackjack\dealer.h(30) : error C2065: 'it' : undeclared identifier
c:\visual studio 2005\projects\blackjack\blackjack\blackjack.cpp(11) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
Build log was saved at "file://c:\Visual Studio 2005\Projects\Blackjack\Blackjack\Debug\BuildLog.htm"
Blackjack - 4 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Anyone have any ideas why this is happening?
deck.cards is actually a vector<Card>