<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2. #include <stdlib.h>  /* srand, rand */
  3. #include <time.h>       /* time */
  4.  
  5.  
  6. int main (void)
  7. {
  8. /* Creating names to recall for the program to compile */
  9. int money1;
  10. int money2;
  11. int money3;
  12. int money4;
  13.  
  14. int bet1;
  15. int bet2;
  16. int bet3;
  17. int bet4;
  18.  
  19. int v1;
  20. int iSecret, iGuess;
  21.  
  22. /* initialize random seed: */
  23. srand (time(NULL));
  24.  
  25. /* generate secret number between 1 and 10: */
  26. iSecret = rand() % 36+1;
  27.  
  28. /* This were I scan for the inputs "Money bet & Lucky number guess" */
  29. {
  30. scanf("%d %d %d %d  %d %d %d %d", &money1, &bet1, &money2, &bet2, &money3, &bet3, &money4, &bet4);
  31.  
  32. /* Below I have listed conditions so that if bet number is invalid it informs the player */
  33. if ((36<bet1)||(36<bet2)||(36<bet3)||(36<bet4)||(1>bet1)||(0>bet2)||(0>bet3)||(0>bet4)) printf ("Error, No bets placed \n\nPick a number between 1 and 36\n\n");
  34.  
  35. /* Below I set IF functions so that if a bet number matches the lucky number the player wins and multiplies total amount bet*/
  36.    else if ((iSecret==bet1)||(iSecret==bet2)||(iSecret==bet3)||(iSecret==bet4)) printf ("Total amount bet is  %d \nBet number %d matches \nTotal amount winnings 8:1 for using four combination \nYou win %d\n\nLucky number is %d\n", money1+money2+money3+money4, iSecret, (money1+money2+money3+money4)*8, iSecret);
  37.  
  38. /* Below I set an IF functions so that if a bet number does not match the lucky number the player knows they lost and how much they loose */
  39.    else if ((iSecret!=bet1)||(iSecret!=bet2)||(iSecret!=bet3)||(iSecret!=bet4)) printf ("Total amount bet is  %d \nNo numbers match, you lost %d\n\nLucky number is %d\n", money1+money2+money3+money4 ,money1+money2+money3+money4, iSecret );
  40.    
  41. }
  42.  
  43. /* Below i display the bet numbers the player put in so that they can check the match for themselves */
  44. printf("Bet numbers are as below \nFirst  %d\nSecond %d\nThird  %d\nFourth %d\n", bet1, bet2, bet3, bet4, iSecret);
  45.  
  46. v1 = rand() % 100;
  47.  
  48.  
  49. }
  50.  
  51. /*
  52.  
  53. Psudo Code
  54.  
  55. Generate random number between 0 and 36
  56.  
  57. SCAN inputs
  58.  
  59. IF bets are invalid notify player
  60.    THEN
  61.       test for valid matches and notify player for wins
  62.    ELSE
  63.       test for no matches, and inform player of their loss
  64. END IF
  65.  
  66.  
  67. */