Click here to Skip to main content
15,918,193 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what is the meaning of this expression int *(*table())[30]; Pin
John R. Shaw2-Jan-07 10:26
John R. Shaw2-Jan-07 10:26 
AnswerRe: what is the meaning of this expression int *(*table())[30]; Pin
Michael Dunn2-Jan-07 15:04
sitebuilderMichael Dunn2-Jan-07 15:04 
GeneralRe: what is the meaning of this expression int *(*table())[30]; Pin
Mark Salsbery2-Jan-07 15:17
Mark Salsbery2-Jan-07 15:17 
AnswerRe: what is the meaning of this expression int *(*table())[30]; Pin
Ayman Mashal3-Jan-07 20:12
Ayman Mashal3-Jan-07 20:12 
GeneralRe: what is the meaning of this expression int *(*table())[30]; Pin
werpa5-Jan-07 8:46
werpa5-Jan-07 8:46 
Questionchar and int mixed array repeat output ! Pin
davvid2-Jan-07 4:10
davvid2-Jan-07 4:10 
AnswerRe: char and int mixed array repeat output ! Pin
CPallini2-Jan-07 4:28
mveCPallini2-Jan-07 4:28 
AnswerRe: char and int mixed array repeat output ! Pin
John R. Shaw2-Jan-07 11:14
John R. Shaw2-Jan-07 11:14 
The simplest solution would be to expand the definition of a card to include the suit; that will also simplify the code dealing with the individual cards.

If you only wish to use a single array to keep track of all the cards, as implied, I would also add a value to the card definition that indicates if the card has been dealt, discarded, or is still available in the deck.

Additionally I would separate the card structure definition from the array declaration so that you would have more flexibility.

If I was creating a card game then a card would be in one of three places:
The Deck: Cards waiting to be dealt (not in play yet).
The Discard Pile: Cards that are out of play.
A Users Hand: Cards that are still in play.

Depending on the game there may be a fourth place (or others):
On the Table: Cards that are in play but available to every one (like in Texas Hold-em).

Ultimately the best way to insure that the cards never repeat is to place them in one and only one location at a time. If the card is in a player's hand then it can not also be in the deck or discard pile, if the card is in the discard pile it can not also be in the deck or the player’s hand.


INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

QuestionDetecting GUI events Pin
narada1502-Jan-07 3:08
narada1502-Jan-07 3:08 
AnswerRe: Detecting GUI events Pin
CPallini2-Jan-07 3:24
mveCPallini2-Jan-07 3:24 
GeneralRe: Detecting GUI events Pin
narada1503-Jan-07 8:48
narada1503-Jan-07 8:48 
QuestionMFC Message map routing question Pin
Arris742-Jan-07 2:42
Arris742-Jan-07 2:42 
AnswerRe: MFC Message map routing question Pin
S Douglas2-Jan-07 23:24
professionalS Douglas2-Jan-07 23:24 
GeneralRe: MFC Message map routing question Pin
Arris743-Jan-07 7:32
Arris743-Jan-07 7:32 
QuestionConvert project VC++6.0 to VC++.Net Pin
Atul232-Jan-07 2:20
Atul232-Jan-07 2:20 
AnswerRe: Convert project VC++6.0 to VC++.Net Pin
Cristian Amarie2-Jan-07 6:41
Cristian Amarie2-Jan-07 6:41 
AnswerRe: Convert project VC++6.0 to VC++.Net [modified] Pin
S Douglas2-Jan-07 23:32
professionalS Douglas2-Jan-07 23:32 
QuestionHow to Invoke Resource-Only DLL Dialogs Pin
Pradeep.Reddy2-Jan-07 1:29
Pradeep.Reddy2-Jan-07 1:29 
QuestionRe: How to Invoke Resource-Only DLL Dialogs Pin
prasad_som2-Jan-07 1:35
prasad_som2-Jan-07 1:35 
AnswerRe: How to Invoke Resource-Only DLL Dialogs Pin
Pradeep.Reddy3-Jan-07 7:17
Pradeep.Reddy3-Jan-07 7:17 
AnswerRe: How to Invoke Resource-Only DLL Dialogs Pin
prasad_som3-Jan-07 19:03
prasad_som3-Jan-07 19:03 
AnswerRe: How to Invoke Resource-Only DLL Dialogs Pin
Johan Pretorius2-Jan-07 2:42
Johan Pretorius2-Jan-07 2:42 
GeneralRe: How to Invoke Resource-Only DLL Dialogs Pin
Pradeep.Reddy3-Jan-07 7:13
Pradeep.Reddy3-Jan-07 7:13 
AnswerRe: How to Invoke Resource-Only DLL Dialogs Pin
Cristian Amarie2-Jan-07 6:50
Cristian Amarie2-Jan-07 6:50 
GeneralRe: How to Invoke Resource-Only DLL Dialogs Pin
Pradeep.Reddy3-Jan-07 7:11
Pradeep.Reddy3-Jan-07 7:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.