Posted: Sat Nov 22, 2008 7:42 pm Post subject: Card dealing
Recently, I was asked about a linked list by a friend (he is still learning c). Told him about it and didn't have an example of a use. The c class I'm in has a homework problem that wants use to modify a card dealing program. I looked at it and hated how the author did it. So i re-wrote the whole thing. It uses a stack and linked list. I just sent it to him so he can learn from it. I've noticed that there are a lot of beginners in the c language on this forum. So I thought that it probably would help some people here.
Things to get out of the source:
*linked list and a stack
*use of pointers
*allocation of memory
*handling bits
If you have any questions, don't be scared to ask.
The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.
What do you use the stack for? Seems like a queue would be better suited to the problem. _________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
I wanted to simulate a real deck of cards, so I wanted the deck to be faced down. A stack would be suited for it. If a queue was used, the first one in will be the first one out. To me, that would be the deck faced up. It's really up to the programmer really.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum