What is going on here?

So I have this assignment for class where I have to build a deck of cards and play a high/low game. All of this is done with enums.
here's the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
     #include<iostream>
using namespace std;

enum suits { CLUBS, DIAMONDS, HEARTS, SPADES };
enum cardValues { TWO, THREE, FOUR, FIVE, SIX, 
				SEVEN, EIGHT, NINE, JACK, QUEEN, 
				KING, ACE };

struct cards{suits suit;
			cardValues card;};

cards deck[52];
cards card1, card2;

void createDeck(cards[]);
void printDeck(cards[]);
void printCard(cards);
void deal(cards[], cards&);
void winner(cards, cards);

int main() {

	cout << "ok\n";
	createDeck(deck);
	printDeck(deck);

	system("pause");
	return 0;
}

void createDeck(cards deck[52]) {
	int i = 0;
	for (suits suit = CLUBS; suit <= SPADES; suit = suits(suit + 1)) {
		for (cardValues card = TWO; card <= ACE; card = cardValues(card + 1)) {
			deck[i].suit = suit;
			deck[i].card = card;
			i++;
		}
	}
}

void printDeck(cards deck[52]) {
	for (int i = 0; i < 52; i++) {
		cout << deck[i].card << " of "
			<< deck[i].suit << endl;
	}
}

and what comes out is:

     ok
0 of 0
1 of 0
2 of 0
3 of 0
4 of 0
5 of 0
6 of 0
7 of 0
8 of 0
9 of 0
10 of 0
11 of 0
0 of 1
1 of 1
2 of 1
3 of 1
4 of 1
5 of 1
6 of 1
7 of 1
8 of 1
9 of 1
10 of 1
11 of 1
0 of 2
1 of 2
2 of 2
3 of 2
4 of 2
5 of 2
6 of 2
7 of 2
8 of 2
9 of 2
10 of 2
11 of 2
0 of 3
1 of 3
2 of 3
3 of 3
4 of 3
5 of 3
6 of 3
7 of 3
8 of 3
9 of 3
10 of 3
11 of 3
0 of 0
0 of 0
0 of 0
0 of 0

Why is it skipping the 'aces' and leaving those last four slots empty?
Last edited on
you forgot ten.
Oh my f'n god. Thanks man I was losing my mind
Topic archived. No new replies allowed.