Help printing a deck of cards

what do I need to do to make this work? Its still a work in progress but before I even get to the 'high/low' card game I just need to print the deck.

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;

enum suits { CLUBS, DIAMONDS, HEARTS, SPADES };
enum cardValues { TWO, THREE, FOUR, FIVE, SIX, 
				SEVEN, EIGHT, NINE, TEN, 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() {

	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++) {
		if (deck[i].card = TWO)
			cout << "Two ";
		else if (deck[i].card == THREE)
			cout << "Three ";
		else if (deck[i].card == FOUR)
			cout << "Four ";
		else if (deck[i].card == FIVE)
			cout << "Five ";
		else if (deck[i].card == SIX)
			cout << "Six ";
		else if (deck[i].card == SEVEN)
			cout << "Seven ";
		else if (deck[i].card == EIGHT)
			cout << "Eight ";
		else if (deck[i].card == NINE)
			cout << "Nine ";
		else if (deck[i].card == TEN)
			cout << "Ten ";
		else if (deck[i].card == JACK)
			cout << "Jack ";
		else if (deck[i].card == QUEEN)
			cout << "Queen ";
		else if (deck[i].card == KING)
			cout << "King ";
		else if (deck[i].card == ACE)
			cout << "Ace ";
		cout << "of ";
		if (deck[i].suit == CLUBS)
			cout << "Clubs\n";
		else if (deck[i].suit == DIAMONDS)
			cout << "Diamonds\n";
		else if (deck[i].suit == HEARTS)
			cout << "Hearts\n";
		else if (deck[i].suit == SPADES)
			cout << "Spades\n";
	}
}


of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Clubs
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Diamonds
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Hearts
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
of Spades
Press any key to continue . . .

why no deck[I].card output?
Last edited on
@BonsaiSuperstar

Line 45 needs a double equals, to check for equality. You have assign. The rest of the else if are skipped when the first assign fails. Change it, and you'll see
awesome thanks man.
I am so sleep deprived an extra set of eyes is an awesome thing to have...
Topic archived. No new replies allowed.