<mosaic.cnfolio.com>
PROGRAM
1. /*
2. Start
3. INPUT
4. Bet one number  as integer
5. Bet one amount as float
6. Bet two number  as integer
7. Bet two amount as float
8. Bet three number  as integer
9. Bet three amount as float
10. Bet four number  as integer
11. Bet four amount as float
12.
13. STORE
14. Bet one winning number = 0 as integer
15. Bet two winning number = 0 as integer
16. Bet three winning number = 0 as integer
17. Bet four winning number = 0 as integer
18. Odds = 35/1 as integer
19.
20. Bet one payout value = 0 as float
21. Bet two payout value = 0 as float
22. Bet three payout value = 0 as float
23. Bet four payout value = 0 as float
24. Bet subtotal = 0 as float
25.
27.   Bet one, bet one amount, bet two, bet two amount, bet three, bet three amount, bet four, bet four amount
28.   Random function()
29.   Bet winning numbers for four bets = Random (38)
30. PRINT
31.   IF bet one <38 and >=0 then
32.   IF bet one amount >= 1 then
33.   If bet one number == 37 then
34. PRINT
35.    Your first bet number is 00
36. ELSE
37.   PRINT
38.       Your first bet number is
39. PRINT
40.   Your bet amount is
41.             END IF
42. IF bet one winning number == 37
43. PRINT
44.       Bet one winning number is 00
45. ELSE
46.    Bet one winning number is
47. END IF
48.    IF bet one number == bet one winning number THEN
49.      Bet one payout = bet one amount * odds+bet one amount
50.      Bet subtotal = bet subtotal + bet one payout
51. PRINT
52.    Youve won ##
53.    Your bet one subtotal is
54. ELSE
55.   Bet one payout = bet one amount
56.   Bet subtotal = bet subtotal- bet one payout
57.   PRINT
58.     You lost, bet one
59.     Your bet one total loss is
60. END IF
61. ELSE
62.    Your bet amount is too low, bet shouldnt be less than £1
63. ELSE
64.    PRINT
65.       Your bet number is not viable
66. END IF
67.
68.
69. Random function()
70.    Bet winning numbers for four bets = Random (38)
71. PRINT
72.   IF bet two <38 and >=0 then
73.   IF bet two amount >= 1 then
74.     If bet two number == 37 then
75. PRINT
76.    Your second bet number is 00
77. ELSE
78.    PRINT
79.       Your second bet number is
80. PRINT
81. Your bet amount is
82.   END IF
83. IF bet two winning number == 37
84. PRINT
85. Bet two winning number is 00
86. ELSE
87. Bet two winning number is
88. END IF
89. IF bet two number == bet two winning number THEN
90. Bet two payout = bet two amount * odds+bet two amount
91. Bet subtotal = bet subtotal + bet two payout
92. PRINT
93. Youve won ##
94. Your bet two subtotal is
95. ELSE
96. Bet two payout = bet two amount
97. Bet subtotal = bet subtotal- bet two payout
98.   PRINT
99.    You lost, bet two
100.    Your bet two total loss is
101. END IF
102. ELSE
103. PRINT
104. Your bet amount is too low, bet shouldnt be less than £1
105. ELSE
106. PRINT
107. Your bet number is not viable
108. END IF
109.
110.
111. Random function()
112. Bet winning numbers for four bets = Random (38)
113. PRINT
114. IF bet three <38 and >=0 then
115. IF bet three amount >= 1 then
116.   If bet three number == 37 then
117.   PRINT
118.   Your third bet number is 00
119. ELSE
120.   PRINT
121.    Your third bet number is
122. PRINT
123. Your bet amount is
124.   END IF
125. IF bet three winning number == 37
126. PRINT
127. Bet three winning number is 00
128. ELSE
129. Bet three winning number is
130. END IF
131. IF bet three number == bet three winning number THEN
132. Bet three payout = bet three amount * odds+bet three amount
133. Bet subtotal = bet subtotal + bet three payout
134. PRINT
135. Youve won ##
136. Your bet three subtotal is
137. ELSE
138. Bet three payout = bet three amount
139. Bet subtotal = bet subtotal- bet three payout
140.   PRINT
141.    You lost, bet three
142.    Your bet three total loss is
143. END IF
144. ELSE
145.    PRINT
146.       Your bet amount is too low, bet shouldnt be less than £1
147. ELSE
148.    PRINT
149.       Your bet number is not viable
150. END IF
151.
152. Random function()
153. Bet winning numbers for four bets = Random (38)
154. PRINT
155. IF bet four <38 and >=0 then
156. IF bet four amount >= 1 then
157.   If bet four number == 37 then
158.   PRINT
159.   Your fourthbet number is 00
160. ELSE
161.   PRINT
162.    Your fourthbet number is
163. PRINT
164. Your bet amount is
165.   END IF
166. IF bet four winning number == 37
167. PRINT
168. Bet four winning number is 00
169. ELSE
170. Bet four winning number is
171. END IF
172. IF bet four number == bet four winning number THEN
173. Bet four payout = bet four amount * odds+bet four amount
174. Bet subtotal = bet subtotal + bet four payout
175. PRINT
176. Youve won ##
177. Your bet four subtotal is
178. ELSE
179. Bet four payout = bet four amount
180. Bet subtotal = bet subtotal- bet four payout
181.   PRINT
182.    You lost, bet four
183.    Your bet four total loss is
184. END IF
185. ELSE
186. Your bet amount is too low, bet shouldnt be less than £1
187. ELSE
188. PRINT
189. Your bet number is not viable
190. END IF
191.
192. IF bet subtotal >0
193.    PRINT
194.       Your total profit is
195. ELSE
196.    PRINT
197.       Your total loss is
198. END IF
199. */
200. #include <stdio.h>
201. #include <stdlib.h>
202. #include <time.h>
203. int main(void)
204.
205. {
206. int bet_one;  /*this is the first bet number you bet on*/
207. float bet_one_prize;  /*The amount of money you place on bet one*/
208. int bet_two; /*this is the second bet number you bet on*/
209. float bet_two_prize; /*The amount of money you place on bet two*/
210. int bet_three;/*this is the third bet number you bet on*/
211. float bet_three_prize;/*The amount of money you place on bet three*/
212. int bet_four;/*this is the fourth bet number you bet on*/
213. float bet_four_prize;/*The amount of money you place on bet four*/
214.
215. int betone_win = 0; /*The winning number on bet one*/
216. int bettwo_win = 0;/*The winning number on bet two*/
217. int betthree_win = 0;/*The winning number on bet three*/
218. int betfour_win = 0;/*The winning number on bet four*/
219. int odds = (35/1); /* The odds decide how much money you win by multiplying the money you bet by 35*/
220.
221. float payout_one=0; /*These variables will calculate the payout of each bet*/
222. float payout_two=0;
223. float payout_three=0;
224. float payout_four=0;
225.
226. float bet_subtotal= 0; /*This calculate the total loss\profit after each bet*/
227.
228. scanf("%d %f %d %f %d %f %d %f", &bet_one, &bet_one_prize, &bet_two, &bet_two_prize, &bet_three, &bet_three_prize, &bet_four, &bet_four_prize);
229.
230.
231. srand(time(0)); /* This function will generate the random numbers for all the bets*/
232.    betone_win= rand() %38;
233.    bettwo_win= rand() %38;
234.    betthree_win= rand() %38;
235.    betfour_win= rand() %38;
236.
237.
238. if (bet_one <38 && bet_one >=0) /*This will ensure that you can't enter a bet number less than 0 and greater than 37*/
239. {
240.  if (bet_one_prize >= 1) /*if statement to make sure the amount isnt less thatn £1*/
241.
242.   {
243.     if (bet_one == 37)
244.     {
245.       printf("Your first bet number is 00 \n");
246.       }
247.     else
248.     {
249.       printf ("Your first bet number is %d \n", bet_one ); /* This will display the number you bet on*/
250.       }
251.
252.     printf("Your bet amount is £%.2f \n", bet_one_prize); /* This is the will display the amount you bet*/
253.
254.     if (betone_win == 37)
255.     {
256.       printf("Bet one winning number is 00\n");
257.       }
258.     else
259.     {
260.       printf ( "Bet one winning number is %d \n", betone_win); /* This will display the randomly generated winning number*/
261.       }
262.
263.     if (bet_one == betone_win) /*This funcion will calculate the payout if the bet number is the same as the winning number*/
264.       {
265.       payout_one=(bet_one_prize*odds+bet_one_prize);
266.       bet_subtotal=(bet_subtotal+payout_one);
267.       printf( "You've won £%.2f \n", payout_one);
268.       printf( "Your bet one subtotal is £%.2f \n \n", bet_subtotal);
269.       }
270.     else
271.       {
272.       payout_one=(bet_one_prize);
273.       bet_subtotal=(bet_subtotal-payout_one);
274.       printf( "You lost £%.2f \n", bet_one);
275.       printf("Your bet one total loss is £%.2f \n \n", bet_subtotal);
276.       }
277.       }
278.   else
279.     {
280.       printf( "Your bet amount is too low, bet should'nt be less than £1 \n \n");
281.         }
282.         }
283.
284. else
285.    {
286.    printf( "Your bet number is not viable \n \n");
287.       }
288. if (bet_two <38 && bet_two >=0) /*This will ensure that you can't enter a bet number less than 0 and greater than 37*/
289. {
290.  if (bet_two_prize >= 1) /*if statement to make sure the amount isnt less thatn £1*/
291.
292.   {
293.     if (bet_two == 37)
294.     {
295.       printf("Your second bet number is 00 \n");
296.       }
297.     else
298.     {
299.       printf ("Your second bet number is %d \n", bet_two ); /* This will display the number you bet on*/
300.       }
301.
302.     printf("Your bet amount is £%.2f \n", bet_two_prize); /* This is the will display the amount you bet*/
303.
304.     if (bettwo_win == 37)
305.     {
306.       printf("Bet two winning number is 00\n");
307.       }
308.     else
309.     {
310.       printf ( "Bet two winning number is %d \n", bettwo_win); /* This will display the randomly generated winning number*/
311.       }
312.
313.     if (bet_two == bettwo_win) /*This funcion will calculate the payout if the bet number is the same as the winning number*/
314.       {
315.       payout_two=(bet_two_prize*odds+bet_two_prize);
316.       bet_subtotal=(bet_subtotal+payout_two);
317.       printf( "You've won £%.2f \n", payout_two);
318.       printf( "Your bet two subtotal is £%.2f \n \n", bet_subtotal);
319.       }
320.     else
321.       {
322.       payout_two=(bet_two_prize);
323.       bet_subtotal=(bet_subtotal-payout_two);
324.       printf( "You lost £%.2f \n", bet_two);
325.       printf("Your bet two total loss is £%.2f \n \n", bet_subtotal);
326.       }
327.       }
328.   else
329.     {
330.       printf( "Your bet amount is too low, bet should'nt be less than £1 \n \n");
331.         }
332.         }
333.
334. else
335.    {
336.    printf( "Your bet number is not viable \n \n");
337.       }
338.
339. if (bet_three <38 && bet_three >=0) /*This will ensure that you can't enter a bet number less than 0 and greater than 37*/
340. {
341.  if (bet_three_prize >= 1) /*if statement to make sure the amount isnt less thatn £1*/
342.
343.   {
344.     if (bet_three == 37)
345.     {
346.       printf("Your third bet number is 00 \n");
347.       }
348.     else
349.     {
350.       printf ("Your third bet number is %d \n", bet_three ); /* This will display the number you bet on*/
351.       }
352.
353.     printf("Your bet amount is £%.2f \n", bet_three_prize); /* This is the will display the amount you bet*/
354.
355.     if (betthree_win == 37)
356.     {
357.       printf("Bet three winning number is 00\n")
358.       }
359.     else
360.     {
361.       printf ( "Bet three winning number is %d \n", betthree_win); /* This will display the randomly generated winning number*/
362.       }
363.
364.     if (bet_three == betthree_win) /*This funcion will calculate the payout if the bet number is the same as the winning number*/
365.       {
366.       payout_three=(bet_three_prize*odds+bet_three_prize);
367.       bet_subtotal=(bet_subtotal+payout_three);
368.       printf( "You've won £%.2f \n", payout_three);
369.       printf( "Your bet three subtotal is £%.2f \n \n", bet_subtotal);
370.       }
371.     else
372.       {
373.       payout_three=(bet_three_prize);
374.       bet_subtotal=(bet_subtotal-payout_three);
375.       printf( "You lost £%.2f \n", bet_three);
376.       printf("Your bet three total loss is £%.2f \n \n", bet_subtotal);
377.       }
378.       }
379.   else
380.     {
381.       printf( "Your bet amount is too low, bet should'nt be less than £1 \n \n");
382.         }
383.         }
384. else
385.    {
386.    printf( "Your bet number is not viable \n \n");
387.       }
388. if (bet_four <38 && bet_four >=0) /*This will ensure that you can't enter a bet number less than 0 and greater than 37*/
389. {
390.  if (bet_four_prize >= 1) /*if statement to make sure the amount isnt less thatn £1*/
391.
392.   {
393.     if (bet_four == 37)
394.     {
395.       printf("Your fourth bet number is 00 \n");
396.       }
397.     else
398.     {
399.       printf ("Your fourth bet number is %d \n", bet_four ); /* This will display the number you bet on*/
400.       }
401.
402.     printf("Your bet amount is £%.2f \n", bet_four_prize); /* This is the will display the amount you bet*/
403.
404.     if (betfour_win == 37)
405.     {
406.       printf("Bet four winning number is 00\n")
407.       }
408.     else
409.     {
410.       printf ( "Bet four winning number is %d \n", betfour_win); /* This will display the randomly generated winning number*/
411.       }
412.
413.     if (bet_four == betfour_win) /*This funcion will calculate the payout if the bet number is the same as the winning number*/
414.       {
415.       payout_four=(bet_four_prize*odds+bet_four_prize);
416.       bet_subtotal=(bet_subtotal+payout_four);
417.       printf( "You've won £%.2f \n", payout_four);
418.       printf( "Your bet four subtotal is £%.2f \n \n", bet_subtotal);
419.       }
420.     else
421.       {
422.       payout_four=(bet_four_prize);
423.       bet_subtotal=(bet_subtotal-payout_four);
424.       printf( "You lost £%.2f \n", bet_four);
425.       printf("Your bet four total loss is £%.2f \n \n", bet_subtotal);
426.       }
427.       }
428.   else
429.     {
430.       printf( "Your bet amount is too low, bet should'nt be less than £1 \n \n");
431.         }
432.         }
433.
434. else
435.    {
436.    printf( "Your bet number is not viable \n \n");
437.       }
438.  if (bet_subtotal > 0 ) /* This if statement will print out the total profit\loss*/
439.   {
440.   printf ("Your total profit is £%.2f \n", bet_subtotal);
441.     }
442.    else
443.      printf ("Your total loss is £%.2f", bet_subtotal);
444.
445.       }