i'm missing the first element in the vector, and have an extra one on the end which has a bad value in it. more precisly, the ace of hearts should be deck[0]. but it's not. the 2 of hearts is deck[0].
it goes thru fine up thru the hearts, then the clubs, then the spades...then, at the very end, i get the 0 (zero) of hearts. i know that the error HAS to be here..
but i just can't find it.Code:void CDeck::createDeck(void) { clearDeck(); //clearDeck(void){ deck.clear(); } CCard c; for(int i = 0; i < 4; i++) //for each suit..... for(int j = 0; j < 13; j++) //create 13 cards { c.set(j+1,j+1,i); //param 1 = rank, param 2 = value , param 3 = suit deck.push_back(c); //deck is of type vector<CCard> //declared in the class header } }
anyone?



LinkBack URL
About LinkBacks


