Sep 8, 2015 at 7:49pm UTC
i need to generate a deck using linked lists. I dont even know how to start
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
**CARD.H**
Class Card
{
int m_face;
char m_suit;
public :
Card(int _face = 2 , char _suit = 3);
~Card();
int GetFace() const ;
char GetSuit() const ;
void SetFace(int _face);
void SetSuit(char _suit);
void Show() const ;
}
**CARD.CPP**
#include "Card.h"
Card::Card(int _face, char _suit)
{
m_face = _face;
m_suit = _suit;
}
Card::~Card()
{
}
int Card ::GetFace() const
{
return m_face;
}
char Card ::GetSuit() const
{
return m_suit;
}
void Card::SetFace(int _face)
{
m_face = _face;
}
void Card::SetSuit(char _suit)
{
m_suit = _suit;
}
void Card::Show() const
{
if (m_face == 11)
cout << " J " << m_suit << endl;
else if (m_face == 12)
cout << " Q " << m_suit << endl;
else if (m_face == 13)
cout << " K " << m_suit << endl;
else if (m_face == 14)
cout << " A " << m_suit << endl;
else
cout << m_face << m_suit << endl;
}
**DECK.H**
#pragma once
#include "stdafx.h"
#include "Card.h"
Class Deck
{
Card m_cards[52];
public :
Deck();
void Initialize();
void Shuffle();
bool Draw(Card& _card);
void Clear();
bool IsEmpty() const ;
}
**DECK.CPP**
#include "Deck.h"
#include"Card.h"
void Deck::Initialize()
{
}
void Deck::Shuffle()
{
}
bool Deck::Draw(Card& _card
{
}
void Deck::Clear()
{
}
bool Deck::IsEmpty() const
{
}
Last edited on Sep 9, 2015 at 7:37pm UTC
Sep 9, 2015 at 2:40am UTC
Is there a reason why you post another thread ?
We simply suggested you vector container because we don't always have the time to open the compiler and try debugging it , with vectors it is cleaner and easier to see what you are trying to do.
If it still doesn't work then at least provide the type of card game !..
peace
Sep 9, 2015 at 7:39pm UTC
this is for a Go fish Card game