taylor.grimes.cs
BAN USER
Use and array to store the cards. I'm assuming you deck of cards will not grow so you don't need a linked list and if it did grow you could still allocate a larger array and copy the values there however this would take more work than a linked list.
int cards[NUM_CARDS];
fill cards array with cards
Anyway shuffle()
for (i = 0; i < NUM_CARDS; i++)
int newLoc = rand() % NUM_CARDS;
temp = cards[i];
cards[i] = cards[newLoc];
cards[newLoc] = temp;
You are going to shuffle without any space increase and only n time. Some cards may stay in the same place because you may have swapped them back and forth. I assumed this was alright. Every card will be touched.
RepChariserMachado, Android test engineer at ABC TECH SUPPORT
Hey, I am Charisar. And I'm working in Stratpro as a meeting director and it's been 3 years ...
RepSuzaneVenable, Applications Developer at 247quickbookshelp
I am an employment manager typically in charge of planning the hiring processes, setting guidelines and timelines, and establishing budgets ...
RepAaricHill, Accountant at A9
I am a friendly and efficient mail clerk with 5 years experience in transportation and distribution environments.I am motivated ...
RepAahnaAllen, AT&T Customer service email at A9
I am a multilingual Judge with 5 years of combined experience in presiding over court proceedings, prosecuting cases, and tirelessly ...
RepGarzaHodge, Backend Developer at Apache Design
I am Garza, and I work in many different research, education, and health care settings with varying roles, levels of ...
why? can you explain?
- taylor.grimes.cs September 21, 2012