Guest User

Untitled

a guest
Dec 10th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. while(!correct)
  2. {
  3. scanf("%d", &position);
  4.  
  5. if (position >= 0 || position <= 51)
  6. {
  7. printf("The card that is present at %d is: %d%c.n", position, deckOfCards[position].cardNumber, deckOfCards[position].cardSuit);
  8. correct = true;
  9.  
  10. if (position == 0)
  11. {
  12. printf("The card that is present before 0 is: %d%c.n", deckOfCards[51].cardNumber, deckOfCards[51].cardSuit);
  13. }
  14.  
  15. else
  16. {
  17. printf("The card that is present before %d is: %d%c.n", position, deckOfCards[position-1].cardNumber, deckOfCards[position-1].cardSuit);
  18. }
  19.  
  20. if (position == 51)
  21. {
  22. printf("The card that is present after 0 is: %d%c.n", deckOfCards[0].cardNumber, deckOfCards[0].cardSuit);
  23. }
  24.  
  25. else
  26. {
  27. printf("The card that is present after %d is: %d%c.n", position, deckOfCards[position+1].cardNumber, deckOfCards[position+1].cardSuit);
  28. }
  29. }
  30.  
  31. else
  32. {
  33. printf("Please try again.n");
  34. }
  35. }
Add Comment
Please, Sign In to add comment