1. // thanks to DRobbins at katazeev
  2.  
  3. #include <iostream>
  4. #include <cstdlib>
  5. #include <string>
  6. #include <time.h>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. //char myLyne[100];
  12. //cin.getline(myLyne,100);
  13.  
  14. string cardsuits[4] = { "Spades", "Hearts", "Diamonds", "Clubs" };
  15. string cardfacesvalues[13] = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace" };
  16. int deck [52];
  17.  
  18. int index;
  19. int newIndex;
  20. int holdVal;
  21. int crdsuit;
  22. int crdval;
  23. int holdIndex;
  24.  
  25. int playerdecks[2][52];
  26. int playerdptr[2]={0,0};
  27. int playerrecoverys[2][52];
  28. int playerdrptr[2]={0,0};
  29. int playerindex;
  30.  
  31. srand ( time(NULL) );
  32.  
  33. for(index=0; index <= 51; index++)
  34. { deck[index]=index; }
  35.  
  36. for(index=0; index <= 51; index++)
  37. { newIndex = rand() % 52;
  38. holdVal = deck[newIndex];
  39. deck[newIndex] = deck[index];
  40. deck[index] = holdVal;
  41. }
  42.  
  43. for(index=0; index <= 51; index++)
  44. { crdsuit=deck[index]/13;
  45. crdval=deck[index]%13;
  46. cout << "Card in Deck is: Index #" << index << ", Card # " << deck[index] << ", a " << cardfacesvalues[crdval] << " of " << cardsuits[crdsuit] << ", worth " << crdval << "\n";
  47. }
  48.  
  49. index=0;
  50. for(playerindex=0; playerindex <= 1; playerindex++)
  51. { for(newIndex=0; newIndex <= 25; newIndex++)
  52. { playerdecks[playerindex][newIndex] = deck[index];
  53. cout << "index: " << index << ", playerindex: " << playerindex << ", newIndex: " << newIndex << ", Val: " << playerdecks[playerindex][newIndex] << "\n";
  54. index++;
  55. }
  56. playerdptr[playerindex]=26;
  57. }
  58.  
  59.  
  60.  
  61.  
  62. char myLine[100];
  63. cin.getline(myLine,100);
  64. return 0;
  65.  
  66. }
  67.  
  68.