Click here to Skip to main content
15,900,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNavigation Error Pin
Shouvik Das31-Dec-06 16:43
Shouvik Das31-Dec-06 16:43 
JokeNavigation Error Pin
Shouvik Das31-Dec-06 19:21
Shouvik Das31-Dec-06 19:21 
AnswerRe: Navigation Error Pin
Nibu babu thomas31-Dec-06 21:06
Nibu babu thomas31-Dec-06 21:06 
GeneralRe: Navigation Error Pin
Shouvik Das31-Dec-06 23:02
Shouvik Das31-Dec-06 23:02 
GeneralRe: Navigation Error Pin
Nibu babu thomas31-Dec-06 23:04
Nibu babu thomas31-Dec-06 23:04 
GeneralRe: Navigation Error Pin
Shouvik Das31-Dec-06 23:10
Shouvik Das31-Dec-06 23:10 
GeneralRe: Navigation Error Pin
Nibu babu thomas1-Jan-07 18:38
Nibu babu thomas1-Jan-07 18:38 
GeneralRe: Navigation Error Pin
Shouvik Das1-Jan-07 18:52
Shouvik Das1-Jan-07 18:52 
QuestionCompression - RAR Pin
Imtiaz Murtaza31-Dec-06 16:37
Imtiaz Murtaza31-Dec-06 16:37 
QuestionDirectshow question Pin
godspeed12331-Dec-06 9:29
godspeed12331-Dec-06 9:29 
AnswerRe: Directshow question Pin
Mark Salsbery31-Dec-06 10:51
Mark Salsbery31-Dec-06 10:51 
QuestionWill do this generate a memory leak? Pin
Joan M30-Dec-06 23:17
professionalJoan M30-Dec-06 23:17 
AnswerRe: Will do this generate a memory leak? Pin
Gary R. Wheeler31-Dec-06 1:22
Gary R. Wheeler31-Dec-06 1:22 
AnswerRe: Will do this generate a memory leak? Pin
Gary R. Wheeler31-Dec-06 1:25
Gary R. Wheeler31-Dec-06 1:25 
AnswerRe: Will do this generate a memory leak? Pin
toxcct31-Dec-06 2:15
toxcct31-Dec-06 2:15 
AnswerYes, if the caller doesn't delete the pointer. Pin
CPallini31-Dec-06 6:58
mveCPallini31-Dec-06 6:58 
Questionno_input comes into reality Pin
davvid30-Dec-06 23:15
davvid30-Dec-06 23:15 
Answerjust a guess Pin
toxcct31-Dec-06 2:27
toxcct31-Dec-06 2:27 
GeneralRe: just a guess Pin
davvid31-Dec-06 2:46
davvid31-Dec-06 2:46 
AnswerRe: no_input comes into reality Pin
CPallini31-Dec-06 11:02
mveCPallini31-Dec-06 11:02 
The problem is in the following initialization:
struct
{
   char face;
    unsigned int value;
}
card[13] =
{    {'2', 2},{'2', 3},{'2', 4},
    {'5', 5},{'6', 6},{'7', 7},
    {'8', 8},{'9', 9},{'10', 10},
    {'J', 10},{'Q', 10},{'K', 10},
    {'A', 1}
};


since you have declare the struct to hold a char plus
an unsigned int. This works fine for all elements but {'10',10} does not match the struct because '10' isn't a character constant, but a multicharacter constant (see MSDN, C++ Character Constants topic, i.e. a 16-bits number that does not fit inside the struct face member (the compiler warns about). What occurs is a cast of the 16-bits value (i.e. a truncation) '10'<->0x3130 to the corrensponding character value '0'<->0x30.
To fix the bug you can either choose a (really) single character to represent 10(e.g. 'X') or change the struct to hold strings, e.g.

struct
{
   char * sFace;
    unsigned int value;
}
card[13] =
{    {"2", 2},{"2", 3},{"2", 4},
    {"5", 5},{"6", 6},{"7", 7},
    {"8", 8},{"9", 9},{"10", 10},
    {"J", 10},{"Q", 10},{"K", 10},
    {"A", 1}
};



hope that helps.
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

QuestionIE7 settings Pin
Waldermort30-Dec-06 20:52
Waldermort30-Dec-06 20:52 
AnswerRe: IE7 settings Pin
Michael Dunn30-Dec-06 21:50
sitebuilderMichael Dunn30-Dec-06 21:50 
QuestionHow do I have a &quot;Splitter Functionality&quot; without using CSplitterWind ? [modified] Pin
erajsri30-Dec-06 18:32
erajsri30-Dec-06 18:32 
AnswerRe: How do I have a &quot;Splitter Functionality&quot; without using CSplitterWind ? Pin
Mark Salsbery31-Dec-06 5:43
Mark Salsbery31-Dec-06 5:43 
GeneralRe: How do I have a &amp;quot;Splitter Functionality&amp;quot; without using CSplitterWind ? Pin
erajsri31-Dec-06 15:36
erajsri31-Dec-06 15:36 

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.