mike, i get a lot of errors with this..
Code:
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
int main()
{
srand(time(NULL)); //Seed randomisation
/*char* GetSuit(Uint8 card){
char *suit[] = {"Clubs", "Diamonds", "Hearts", "Spades"};
return suit[card/13];
}
char* GetRank(Uint8 card)
{
char *rank[] = {"Ace", "Two", "Three", "Four", "Five",
"Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
return rank[card%13];
}*/
int deck[52];
int i, temp, random;
// Init deck
for(i=0; i<52; i++)
deck[i] = i;
//Shuffle deck
for(i=0; i<52; i++)
{
random = rand() % 52;
temp = deck[i];
deck[i] = deck[ random ];
deck[ random ] = temp;
}
char* GetSuit(Uint8 card){
char *suit[] = {"Clubs", "Diamonds", "Hearts", "Spades"};
return suit[card/13];
}
char* GetRank(Uint8 card)
{
char *rank[] = {"Ace", "Two", "Three", "Four", "Five",
"Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
return rank[card%13];
}
printf("%d", deck[i]);
_getche();
return 0;
}