Click here to Skip to main content
16,007,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionunsigned char (*) warning msg Pin
ikbahrian29-Dec-06 2:42
ikbahrian29-Dec-06 2:42 
AnswerRe: unsigned char (*) warning msg Pin
CPallini29-Dec-06 3:13
mveCPallini29-Dec-06 3:13 
GeneralRe: unsigned char (*) warning msg Pin
ikbahrian29-Dec-06 3:29
ikbahrian29-Dec-06 3:29 
AnswerRe: unsigned char (*) warning msg Pin
David Crow29-Dec-06 3:22
David Crow29-Dec-06 3:22 
GeneralRe: unsigned char (*) warning msg Pin
ikbahrian1-Jan-07 4:25
ikbahrian1-Jan-07 4:25 
Questionchar set int value.. Pin
davvid29-Dec-06 2:41
davvid29-Dec-06 2:41 
AnswerRe: char set int value.. Pin
Joan M29-Dec-06 2:51
professionalJoan M29-Dec-06 2:51 
AnswerRe: char set int value.. Pin
David Crow29-Dec-06 3:33
David Crow29-Dec-06 3:33 
While not a C++ solution, how about something like:

struct
{
    char face;
    unsigned int value;
} card[13] = {
    {'2', 2},{'3', 3},{'4', 4},
    {'5', 5},{'6', 6},{'7', 7},
    {'8', 8},{'9', 9},{'t', 10},
    {'j', 10},{'q', 10},{'k', 10},
    {'a', 11}
};

void main( void )
{
    srand(time(NULL));

    int x = rand() % 13;
    printf("Card %c is worth %u points.\n", card[x].face, card[x].value);
    x = rand() % 13;
    printf("Card %c is worth %u points.\n", card[x].face, card[x].value);
}
You'll need to figure out how to handle the Ace, however.


"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

"Judge not by the eye but by the heart." - Native American Proverb


GeneralRe: char set int value.. Pin
davvid30-Dec-06 4:29
davvid30-Dec-06 4:29 
GeneralRe: char set int value.. Pin
David Crow2-Jan-07 3:05
David Crow2-Jan-07 3:05 
QuestionVC++6: Meaning of memory leaks that are dumped when I close the app. Pin
Joan M29-Dec-06 2:01
professionalJoan M29-Dec-06 2:01 
AnswerRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
CPallini29-Dec-06 2:34
mveCPallini29-Dec-06 2:34 
GeneralRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
Joan M29-Dec-06 2:38
professionalJoan M29-Dec-06 2:38 
GeneralRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
James R. Twine29-Dec-06 5:12
James R. Twine29-Dec-06 5:12 
GeneralRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
Gary R. Wheeler29-Dec-06 5:19
Gary R. Wheeler29-Dec-06 5:19 
GeneralRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
Joan M29-Dec-06 2:39
professionalJoan M29-Dec-06 2:39 
GeneralRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
CPallini29-Dec-06 2:57
mveCPallini29-Dec-06 2:57 
GeneralRe: VC++6: Meaning of memory leaks that are dumped when I close the app. Pin
James R. Twine29-Dec-06 5:15
James R. Twine29-Dec-06 5:15 
QuestionMFC DLL question Pin
FredrickNorge29-Dec-06 1:18
FredrickNorge29-Dec-06 1:18 
AnswerRe: MFC DLL question Pin
Don Box29-Dec-06 1:30
Don Box29-Dec-06 1:30 
AnswerRe: MFC DLL question Pin
Joan M29-Dec-06 2:03
professionalJoan M29-Dec-06 2:03 
GeneralRe: MFC DLL question Pin
FredrickNorge29-Dec-06 2:26
FredrickNorge29-Dec-06 2:26 
Questionc++ Pin
manu_220529-Dec-06 1:13
manu_220529-Dec-06 1:13 
QuestionRe: c++ Pin
CPallini29-Dec-06 2:22
mveCPallini29-Dec-06 2:22 
AnswerRe: c++ Pin
Nemanja Trifunovic29-Dec-06 6:35
Nemanja Trifunovic29-Dec-06 6:35 

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.