i need some help on this, im making a blackjack game and i need to make a stack of cards and i dont know what to do so just get me started is all im really askin for.

here is what i have so far

#include <stack>
#include <list>
#include <iostream>
#include <conio.h>
#include <string>

using namespace std;

const DECKS = 8;

enum suit { Clubs, Diamonds, Hearts, Spades};
enum value { Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King};

/****************************************************/
class Node
{
	private:
		int	data;
		Node* next;

	public:
		Node();
		Node(int data);
		~Node(){};
		Node(Node& node);
		Node& operator = (Node& node);

		int getData() {return data;};
		Node* getNext() {return next;};

		void setData(int data) { this->data = data;};
		void setNext(Node* next) { this->next = next;};
};

Node::Node()
{
	data = 0;
	next = NULL;
}

Node::Node(int data)
{
	this->data = data;
	next = NULL;
}

Node::Node(Node& node)
{
	this->data = node.data;
	next = NULL;
}

Node& Node::operator= (Node& node)
{
	this->data = node.data;
	next = NULL;
	return *this;
}
/**************************************************************/

/**************************************************************/
struct Card
{
	stack<Card> deck;
	static int counters[52 * DECKS];

	int jack,
	   queen,
	    king;

	int ace();
	Card();
	~Card();
	Card (Card& card);
	Card operator = (Card& card);
};

Card::Card()
{
	jack = 10;
	queen = 10;
	king = 10;
}

int ace()
{
	int choice;

	cout << "do you want your Ace/s to be a 1 or an 11?" << endl;
	cin >> choice;

	return choice;
}
/**************************************************************/
class Player 
{
private:
	
	
	static int players;
	int val; // sum of all the cards

public:

	Player();
	~Player();
	Player (const Player& player);
	int getSize() {return size};
	

};

Player::Player()
{
	val = 0;
	
}

class Playerlist
{
private:

	int size; //number of players
	Player* player; // array 

public:
	Playerlist();
	~Playerlist();
	Playerlist (const Playerlist& playerlist);
	int getSize() {return size;}

	Player* getPlayer(int index) {return &player[index];}
};

Playerlist::Playerlist()
{
	player = NULL;
		cout << "How many players will be playing? " << endl;

	cout << "* Number of players should not exceed the cubic dimensions * " << endl;
	cin >> size;
	player = new Player [size];

}

Playerlist::~Playerlist()
{
	delete [] player;
}

Playerlist::Playerlist (const Playerlist& playerlist)
{
	size = playerlist.size;
	player = new Player [size];
	for(int s = 0; s < size; s++)
		player[s] = playerlist.player[s];
}
/***************************************************************/
	int Player::players = 1; //static players

void main()
{
	Playerlist p;
	Card c;

}
Member Avatar for iamthwee

I've not tried your code but it looks to be well organised. Was there a specific question you wanted to ask regarding the game?

What exactly are you going to do with your deck of cards? I presume you'll have some common routines such as "shuffle", "cut deck", etc. but different card games use different rules. A totally generic deck might not be possible, or even desirable. I suggest you decide first which games you want to simulate, then you'll get a much clearer idea of what to do. Not all card games treat the deck as a stack either. some card games treat it more like a queue, others involve a random draw from the middle - keep that in mind when you decide what sort of container to keep the cards in.

its goin to be casino like but im not goin to follow all the ruled there will be 8 decks in the stack of cards and u just take a card from the top of the deck after its shuffled. im not goin to bother with cutting the eck though

i dont think my code actually works i got a few error i think still with the enumerator types but i dont know how to start the stack of cards. i have to do that to basically do the rest of the program so i know what everything is

It sounds like you're trying to do a bit too much at once - start out with getting the program to compile with just one card.. then get it to compile with a deck of cards... then take small steps adding more functionality as yóú go.
Personally i'd change the Card structure. To my mind, the only 2 bits of information a playing card holds are its suit and its rank - a card doesn't hold information about the rest of the deck.

The enums are definitely erroneous, you can't begin an identifier with a number, so you'll need to use ace, two, three, four, five etc, instead.

see thats the thing i dont even know how about make one card let alone a stack of them and i fixed the enum thing and it compiles now

Member Avatar for iamthwee

Should b simple, u can do this without a class heirarchy anyhoo.

An idea is the same, regardless of how you choose to represent it. Get it down on paper then continue from there.

ThanQ

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.