<mosaic.cnfolio.com>
PROGRAM
1. #include <stdio.h>
2. #include <stdlib.h>
3. #include <time.h>
4.
5.
6. int main()
7.
8. /* the time.h library provids an unseeable clock to base the random number generator on */
9. {
10.
11. int beta;
12. int moneya;
13. int betb;
14. int moneyb;
15. int betc;        /*these set the intergers to there respective names*/
16. int moneyc;
17. int betd;
18. int moneyd;
19. int winnings;
20. int loss;
21.
22.  int i, n;
23.    time_t t;  /*setting  the variables of the clock for the random number generator*/
24.
25.    n = 1;
26.
27.    srand((unsigned) time(&t))/*setting the random generator equal to the clock to provide a new seed each time a new random number is called, therefore removing the problem of having the same number repeated */
28.
29.
30. int r = rand() % 39; /*setting the max randomnumber */
31.
32. printf("Place Your Bets The Order Of 1 Bet Followed By The Amount Of Money");
33.
34. scanf("%d %d %d %d %d %d %d %d", &beta, &moneya, &betb, &moneyb, &betc, &moneyc, &betd, &moneyd); /*scanning for inputs */
35.
36. printf(" £%d on %d \n", moneya, beta);
37.
38. printf(" £%d on %d \n", moneyb, betb);
39.
40. printf(" £%d on %d \n", moneyc, betc);
41.
42. printf(" £%d on %d \n", moneyd, betd);
43.
44. printf(" The Ball Lands On %d \n", r);
45.
46.   if (beta == r){
47.      winnings = moneya * 37;
48.      printf(" You Have Won £%d \n", winnings);   /*these if statments will determine if you have won or not */
49.      }
50.   else if (betb == r){
51.      winnings = moneyb * 37;
52.      printf(" You Have Won £%d \n", winnings);
53.      }
54.   else if (betc == r){
55.      winnings = moneyc * 37;
56.      printf(" You Have Won £%d \n", winnings);
57.      }
58.   else if (betd == r){
59.      winnings = moneyd * 32;
60.      printf(" You Have Won £%d \n", winnings);
61.      }
62.   else {
63.   printf(" You have not won anything");
64.   }
65. loss = winnings - moneya - moneyb - moneyc - moneyd;
66.
67.   if (loss > 0){
68.   printf(" You Have Made A Profit Of £%d \n", loss); /*these determine if you have made a profit or not*/
69.   }
70.   else {
71.   printf(" You Have Lost £%d \n", loss);
72.   }
73.
74. }