i'm trying to print the suits of the cards

typedef enum{diamonds, spades, hearts, clubs}SUIT;

typedef struct{
       SUIT suit;
       int value;
       }CARD;

typedef struct{
       CARD *cards[52];
       int atual; /*indicates the next card to be withdrawal of the deck*/
       }DECK;

typedef struct{
       char name[30];
       CARD hand[3];
       CARD biggest_card;
       int num_victories;
       }PLAYER;


switch(suit)
{
              case 0:
                      return 4;
                      break;
              case 1:
                      return 6;
                      break;
              case 2:
                      return 3;
                      break;
              case 3:
                      return 5;
                      break;
}

//for example...
printf("%d %c", deck[i].cartas.value, deck[i].cartas.suit);

it prints, but all characters are wrong... and i look for then in the table ascii

does any one knows why this doesnt work?

who knows? what little bit of code you posted makes no sense. you have no MAIN statement. i couldnt compile it if i wanted to. maybe if you post your code, we can see whats going on.


but if you want me to take a stab at it,

FIRST, i'd guess youre not callign your structure correctly.

assuming deck[] is an instantiation of DECK, so it only has two elements:

deck[].cards
deck[].atual

...

SECONDLY, *cards[52] looks wrong. you should lose the pointer, and just make it a 52 element array


.

who knows? what little bit of code you posted makes no sense. you have no MAIN statement. i couldnt compile it if i wanted to. maybe if you post your code, we can see whats going on.
.

my code its gigant, and it's all in portuguese..

i just wanna know how to print the characters of the suits
in my enum... diamond=0, spades=1, heart=2, club=3
i know that in ascii diamond=4, spades=6, heart=3, club=5
so i did the switch-case that i post
but when i try to print, diamond its blank, spades its a smile white, heart its a smile black and club its heart.

????

FIRST, i'd guess youre not callign your structure correctly.

assuming deck[] is an instantiation of DECK, so it only has two elements:

deck[].cards
deck[].atual.

hey... DECK has 2 elements, but one of then isn't of the type CARD?
and CARD has also 2 elements (value and suit)
so... deck.cards.value and deck.cards.suit it's correct!

'cartas' its in portuguese and in english its cards
i just forgot to translate

SECONDLY, *cards[52] looks wrong. you should lose the pointer, and just make it a 52 element array
.

and the struct DECK was gived by my theater, so i have to use like this
i have been using, and didn't have any problem

You're probably thinking of some old DOS character set, which used to have card suit symbols down in the low character values.

But unless you're using an old DOS compiler on an old DOS machine, the chances of this working are remote (or non-existent).

Begin by telling us which OS/Compiler you're actually using. And try to be more specific than say "windows" and "borland".

hm... more specific how?

i'm using win XP and DEV C++, thats all i know

Close enough.

And it won't work. Dev-C++ creates win32 console programs, not DOS programs.

http://msdn.microsoft.com/en-us/library/ms682064(VS.85).aspx
You could try messing about with the code page the console uses, but TBH, I've no idea what you might change it to.

At this point, I would normally recommend you start looking at UNICODE, which has a much larger character set. Somewhere in there you should find the symbols you're looking for. Then you hope that the font you've been provided with has glyphs at the code points of interest.

commented: Nothing to add really, apart from the confusion between dos and the command prompt. +15
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.