Advertisement
pichumy

Untitled

Jan 27th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "problem1helpers.h"
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7.  
  8. card **hand;
  9. deck *fulldeck;
  10. int i, j, k;
  11.  
  12. /* create an array of card pointers */
  13. hand = (card **)malloc(sizeof(card *)*5);
  14. /* make a card for each one */
  15. for(i=0;i<5;i++)
  16. hand[i] = make_card(i%4, (i*17)%14);
  17.  
  18. /* print out the cards in the hand */
  19. printf("Hand: ");
  20. for(i=0;i<5;i++)
  21. print_card(hand[i]);
  22. printf("\n");
  23.  
  24. /* make a standard deck of cards */
  25. fulldeck = make_standard_deck();
  26. if (fulldeck == NULL)
  27. {
  28. printf("make_standard_deck not yet implemented ... exiting\n");
  29. exit(0);
  30. }
  31.  
  32. /* print out all of the cards */
  33. for(i=0;i<fulldeck->num_cards;)
  34. for(j=0;j<13 && i<fulldeck->num_cards;j++,i++)
  35. print_card(&(fulldeck->cards[i]));
  36.  
  37.  
  38. /* compare some cards */
  39. printf("Compare: ");
  40. print_card(&(fulldeck->cards[5]));
  41. print_card(&(fulldeck->cards[17]));
  42. printf(": %d\n",compare(&(fulldeck->cards[5]),&(fulldeck->cards[17])));
  43.  
  44. printf("find index: C 5: %d", find_index(fulldeck,0,5));
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement