WE hv an immediate opening for Manual Testers for our leading MNC client in Bangalore.
EXP:3+yrs(Mandatory) ONLY MANUAL TESTERS FM BANGALORE NEED 2 APPLY. Mail your profile asap. Regards, Aarthi, Team Lead, Vital Consulting 270, 3rd Cross, Domlur 2nd stage, Bangalore - 560 071 Mobile:9880014626 Tel: +91-80-51254370/80(Direct), Board : +91-80-51150716/7 [EMAIL PROTECTED] www.vitalconsultingindia.com -- The information transmitted is intended only for the person or entity to which it is addressed to and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from your computer. Thank you for your understanding & co-operation. -----Original Message----- From: C-Paradise@yahoogroups.com [mailto:[EMAIL PROTECTED] Behalf Of dxjester21 Sent: Thursday, June 16, 2005 3:38 AM To: C-Paradise@yahoogroups.com Subject: [C-Paradise] Re: Pointers and Arrays --- In C-Paradise@yahoogroups.com, "czk96" <[EMAIL PROTECTED]> wrote: > I am working on one of the exercise in the Dietel and Dietel book. > It is about a card game and it wants you to deal out five cards and > determine if there is a pair, two pair, etc. I am a little fuzzy on > a few things. What I know (which is very little) > > 1. The cards are shuffled and randomly 5 cards are dealt. > 2. I know I need to be able to get to the five cards and either > point > to them or place them in another array. > 3. I have to be able to access this array and compare them (have no > clue on this one) > > I have attempted to use the char *strcpy command, but this did not > seem > to help. > > Any help would be appreciated. > > > Thanks, > > Tony Hey Tony, I just recently did this program last semester at Cal State Fullerton. This is how I accomplished it. - Create 3 arrays: 1 with 52 slots (to hold all 52 cards in a deck) 2 arrays with 5 slots each that will determine the face and suit value of the 5 cards that you have been dealt. - Then, when initializing the array, use a random number generator to generate numbers in the range of 1 through 52. - How I categorized the cards is fairly simple. The values 1-13 represented all the Heart-suited cards, values 14-26 represented the Diamond-suited cards, 27-39 represented the Spade-suited cards, and final 40-52 values represented the Clubs. Each suit is assigned a value between the range of 1-4 (i.e. 1-hearts, 2-diamonds, etc), and each face value is assigned a value in the range of 1-13 (with 13 representing the King, 12 representing a Queen, etc). - From there, you must retrieve the face and suit values of the first 5 cards in the array i.e. a[0] , a[1], a[2], a[3], a[4]. Create public functions such as 'int getSuitValue(int x)' and 'int getFaceValue(int x) to retrieve these values. - Then for each of the 5 cards, the corresponding face values are inserted into one of the 5-slotted arrays (aptly named 'faceArray[5]') and the corresponding suit values are then dispersed into the other 5 slotted array (i.e 'suitValue[5]') - So when evaluating hands, one can only look in 1 of the 2 arrays. For example, if the first 5 cards in the 52 slotted array are 1,26, 52,13, and 40, the suitValue[5] array would contain the values{1,2,4,1,3). Likewise the faceValue[5] array would contain the values {Ace, King, King, King, King), which eventually would mean that the hand that you are currently holding is a four of a kind. For a three of a kind, one would only check in the faceValue array, and check to see if there is 3 and ONLY 3 values that match together. Information contained in the suited value is irrelevant(unless suits are used as a means of evaluating a hand) - It's best that you evaluate the best hand (Royal Flush) and eventually work your way down the ladder, by implementing if/else if branch statements. Royal Flush -> Straight Flush -> Four of a kind -> etc. - I might have the source code if you still need help. >-----------------------------------------~-~> CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at http://www.eScribe.com/software/C-Paradise/ >------------------------------------------_-> Yahoo! Groups Links >-----------------------------------------~-~> CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at http://www.eScribe.com/software/C-Paradise/ >------------------------------------------_-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/C-Paradise/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/