<mosaic.cnfolio.com>
PROGRAM
1. /*/*
2. start
3. define main functions of the body
4.
5. interger BetOne
6. float BetOneAmount
7. interger BetTwo
8. float BetTwoAmount
9. interger BetThree
10. float BetThreeAmount
11. interger BetFour
12. float BetFourAmount
13.
14.
15. interger ResultOne      equal to 0
16. interger ResultTwo      equal to 0
17. interger ResultThree    equal to 0
18. interger ResultFour     equal to 0
19.
20. float PayOne=0
21. float PayTwo=0
22. float PayThree=0
23. float PayFour=0
24. float PayTotal=0
25. interger multi = 35
26.
27. Scan all intergers and floats
28.
29. Randomize
30. ResultOne   = Random number <38
31. ResultTwo   = Random number <38
32. ResultThree    = Random number <38
33. ResultFour  = Random number <38
34.
35.
36. Say  Welcome to the SAIL AWAY Casino!!!
37. Say  Please place your bets, followed by the amount that you would like to place down
38. Say  (Please note: to place a bet on 00, enter the number '37' into the machine)
39.
40.
41.
42.
43. Say BetOne interger
44.
45. if betone is less than 38 and betone is more than or equal to 0
46. if BetOne = 37
47.    say your first bet number is 00
48. otherwise
49.    say your bet number is "amount inputted"
50.
51. say your first bet number is "amount inputted"
52.
53. if ResultOne is 37
54.    say the first winning bet number is 00
55. otherwise
56.    say the first winning bet is "random number generated"
57.
58. if BetOne is the same as Resultone
59. {
60.    PayOne = BetOne times the odd (Which is odd = 35/1)
61.    PayTotal = (how much they got altogether + how much they placed + how much they won in this bet)
62.    say WINNER! Your payout for your first bet is "amount altogether"
63.    say Your subtotal is "how much they won for this bet alone"
64. otherwise
65.    PayOne = BetOneAmount
66.    PayTotal = (How much they got altogther - how much they placed)
67.    say LOSER! For your first bet, you have lost an amoout of "amount they placed"
68.    say Your subtotal is "How much the lost this bet"
69. }
70.
71. otherwise
72.    say The first bet number entered is out of range, please try again within the range of 0-36, or enter 37    to place a bet on 00
73.
74.
75.
76.
77.
78.
79. Say BetTwo interger
80.
81. if betTwo is less than 38 and betTwo is more than or equal to 0
82. if BetTwo = 37
83.    say your Second bet number is 00
84. otherwise
85.    say your bet number is "amount inputted"
86.
87. say your Second bet number is "amount inputted"
88.
89. if ResultTwo is 37
90.    say the Second winning bet number is 00
91. otherwise
92.    say the Second winning bet is "random number generated"
93.
94. if BetTwo is the same as ResultTwo
95. {
96.    PayTwo = BetTwo times the odd (Which is odd = 35/1)
97.    PayTotal = (how much they got altogether + how much they placed + how much they won in this bet)
98.    say WINNER! Your payout for your Second bet is "amount altogether"
99.    say Your subtotal is "how much they won for this bet alTwo"
100. otherwise
101.    PayTwo = BetTwoAmount
102.    PayTotal = (How much they got altogther - how much they placed)
103.    say LOSER! For your Second bet, you have lost an amoout of "amount they placed"
104.    say Your subtotal is "How much the lost this bet"
105. }
106.
107. otherwise
108.    say The Second bet number entered is out of range, please try again within the range of 0-36, or enter 37   to place a bet on 00
109.
110.
111.
112.
113.
114. Say BetThree interger
115.
116. if betThree is less than 38 and betThree is more than or equal to 0
117. if BetThree = 37
118.    say your Third bet number is 00
119. otherwise
120.    say your bet number is "amount inputted"
121.
122. say your Third bet number is "amount inputted"
123.
124. if ResultThree is 37
125.    say the Third winning bet number is 00
126. otherwise
127.    say the Third winning bet is "random number generated"
128.
129. if BetThree is the same as ResultThree
130. {
131.    PayThree = BetThree times the odd (Which is odd = 35/1)
132.    PayTotal = (how much they got altogether + how much they placed + how much they won in this bet)
133.    say WINNER! Your payout for your Third bet is "amount altogether"
134.    say Your subtotal is "how much they won for this bet alThree"
135. otherwise
136.    PayThree = BetThreeAmount
137.    PayTotal = (How much they got altogther - how much they placed)
138.    say LOSER! For your Third bet, you have lost an amoout of "amount they placed"
139.    say Your subtotal is "How much the lost this bet"
140. }
141.
142. otherwise
143.    say The Third bet number entered is out of range, please try again within the range of 0-36, or enter 37    to place a bet on 00
144.
145.
146.
147.
148.
149. Say BetFour interger
150.
151. if betFour is less than 38 and betFour is more than or equal to 0
152. if BetFour = 37
153.    say your Fourth bet number is 00
154. otherwise
155.    say your bet number is "amount inputted"
156.
157. say your Fourth bet number is "amount inputted"
158.
159. if ResultFour is 37
160.    say the Fourth winning bet number is 00
161. otherwise
162.    say the Fourth winning bet is "random number generated"
163.
164. if BetFour is the same as ResultFour
165. {
166.    PayFour = BetFour times the odd (Which is odd = 35/1)
167.    PayTotal = (how much they got altogether + how much they placed + how much they won in this bet)
168.    say WINNER! Your payout for your Fourth bet is "amount altogether"
169.    say Your subtotal is "how much they won for this bet alFour"
170. otherwise
171.    PayFour = BetFourAmount
172.    PayTotal = (How much they got altogther - how much they placed)
173.    say LOSER! For your Fourth bet, you have lost an amoout of "amount they placed"
174.    say Your subtotal is "How much the lost this bet"
175. }
176.
177. otherwise
178.    say The Fourth bet number entered is out of range, please try again within the range of 0-36, or enter 37   to place a bet on 00
179.
180.
181.
182.
183. say Your Total earnings from these 4 bets are: "amount they won altogether"
184. say Thank you for playing. We hope to see you again soon
185.
186. */
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204. #include <stdio.h>
205. #include <stdlib.h>
206. #include <time.h>
207.
208. int main(void)
209.    {
210. int BetOne;          /*Intergers and Float variables for the input numbers */
211. float BetOneAmount;
212. int BetTwo;
213. float BetTwoAmount;
214. int BetThree;
215. float BetThreeAmount;
216. int BetFour;
217. float BetFourAmount;
218.
219.
220. int ResultOne=0;
221. int ResultTwo=0;
222. int ResultThree=0;
223. int ResultFour=0;
224.
225. float PayOne=0;    /*floats used as money is up to 2 decimal places*/
226. float PayTwo=0;
227. float PayThree=0;
228. float PayFour=0;
229. float PayTotal=0;
230. int multi=35;    /* the multiplier for the winnings, which is 35 */
231.
232. scanf("%d %f %d %f %d %f %d %f", &BetOne, &BetOneAmount, &BetTwo, &BetTwoAmount, &BetThree, &BetThreeAmount, &BetFour, &BetFourAmount); /* scans the input of bets from above*/
233.
234.
235. srand(time(0));        /* rand variable is used for the winning numbers, with the cap being 37 */
236. ResultOne = rand()%38;
237. ResultTwo = rand()%38;
238. ResultThree = rand()%38;
239. ResultFour = rand()%38;
240.
241.
242. printf("| Welcome to the SAIL AWAY Casino!!! \n");                 /* print varibale to display instructions*/
243. printf("| Please place your bets, followed by the amount that you would like to place down \n");
244. printf("| (Please note: to place a bet on 00, enter the number '37' into the machine) \n \n");
245.
246.
247.
248.
249.
250.
251.
252. printf("| Bet One \n");
253.
254. if (BetOne < 38 && BetOne >= 0)         /*allows the player to bet the number 0 and having the cap at number 37*/
255. {
256. if (BetOne == 37)        /*programme thinks that 00 is the same as 0, so the number 37 is used as 00 */
257. {
258.   printf("Your first bet number is 00 \n");    /* displays 37 as 00 */
259.   }
260. else                                /* else variable after if, for the rest of the numbers 0-36 */
261. {
262.   printf("Your first bet number is %d \n", BetOne);
263.   }
264. printf("Your bet is £%.2f \n", BetOneAmount);      /*Displays the amount that the player has bet on his/her number */
265.
266. if (ResultOne == 37)            /*if the rand varibale draws a 37, then the number is converted as 00 */
267. {
268.   printf("The first winning bet number is 00 \n");  /* Displays 37 as 00 */
269. }
270. else
271. {
272.   printf("The first winning bet number is %d \n", ResultOne);    /*Displays the other rand number as normal */
273. }
274.
275. if (BetOne == ResultOne)                  /* if statement used if the player has won */
276. {
277.   PayOne=(BetOne*multi);             /*Times the amount placed by the win ( User amount x 35) */
278.   PayTotal=(PayTotal+PayOne+BetOne);      /* PayTotal being the amount they have won all together + how much they placed + how much they won */
279.   printf("WINNER! Your payout for your first bet is £%.2f \n", PayOne+BetOne);     /* Displays that the player has won and displays the amount that they have won */
280.   printf("Your subtotal is £%.2f \n", PayTotal); /* Displays how much they have won for this bet alone */
281.
282.   }
283. else
284. {
285.   PayOne=(BetOneAmount);         /* else variable if the player has lost the bet */
286.   PayTotal=(PayTotal-PayOne);  /* subtracts the amount that the player has placed from the total earnings */
287.   printf("LOSER! For your first bet, you have lost an amoout of -£%.2f \n", PayOne);   /*Displays that  the player has lost the roulette and displays how much they lost */
288.   printf("Your subtotal is £%.2f \n \n \n", PayTotal);   /* Displays how much they have lost for this bet alone */
289.
290.   }
291.   }
292. else
293. {
294. printf("The first bet number entered is out of range, please try again within the range of 0-36, or enter 37 to place a bet on 00. \n \n \n");
295.    }      /*DIsplays that the player has not placed a number or the number is too high */
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306. printf("| Bet Two \n");
307.
308. if (BetTwo < 38 && BetTwo >= 0)
309. {
310. if (BetTwo == 37)
311. {
312.   printf("Your second bet number is 00 \n");
313.   }
314. else
315. {
316.   printf("Your second bet number is %d \n", BetTwo);
317.   }
318. printf("Your bet is £%.2f \n", BetTwoAmount);
319.
320. if (ResultTwo == 37)
321. {
322.   printf("The second winning bet number is 00 \n");
323. }
324. else
325. {
326.   printf("The second winning bet number is %d \n", ResultTwo);
327. }
328.
329. if (BetTwo == ResultTwo)
330. {
331.   PayTwo=(BetTwo*multi);
332.   PayTotal=(PayTotal+PayTwo+BetTwo);
333.   printf("WINNER! Your payout for your second bet is £%.2f \n", PayTwo+BetTwo);
334.   printf("Your subtotal is £%.2f \n", PayTotal);
335.
336.   }
337. else
338. {
339.   PayTwo=(BetTwoAmount);
340.   PayTotal=(PayTotal-PayTwo);
341.   printf("LOSER! For your second bet, you have lost an amoout of -£%.2f \n", PayTwo);
342.   printf("Your subtotal is £%.2f \n \n \n", PayTotal);
343.
344.   }
345.   }
346. else
347. {
348. printf("The second bet number entered is out of range, please try again within the range of 0-36, or enter 37 to place a bet on 00. \n \n \n");
349.    }
350.
351.
352.
353.
354.
355.
356.
357.
358. printf("| Bet Three \n");
359.
360. if (BetThree < 38 && BetThree >= 0)
361. {
362. if (BetThree == 37)
363. {
364.   printf("Your third bet number is 00 \n");
365.   }
366. else
367. {
368.   printf("Your third bet number is %d \n", BetThree);
369.   }
370. printf("Your bet is £%.2f \n", BetThreeAmount);
371.
372. if (ResultThree == 37)
373. {
374.   printf("The third winning bet number is 00 \n");
375. }
376. else
377. {
378.   printf("The third winning bet number is %d \n", ResultThree);
379. }
380.
381. if (BetThree == ResultThree)
382. {
383.   PayThree=(BetThree*multi);
384.   PayTotal=(PayTotal+PayThree+BetThree);
385.   printf("WINNER! Your payout for your third bet is £%.2f \n", PayThree+BetThree);
386.   printf("Your subtotal is £%.2f \n", PayTotal);
387.
388.   }
389. else
390. {
391.   PayThree=(BetThreeAmount);
392.   PayTotal=(PayTotal-PayThree);
393.   printf("LOSER! For your third bet, you have lost an amoout of -£%.2f \n", PayThree);
394.   printf("Your subtotal is £%.2f \n \n \n", PayTotal);
395.
396.   }
397.   }
398. else
399. {
400. printf("The third bet number entered is out of range, please try again within the range of 0-36, or enter 37 to place a bet on 00. \n \n \n");
401.    }
402.
403.
404.
405.
406.
407.
408.
409.
410.
411.
412.
413.
414.
415. printf("| Bet Four \n");
416.
417. if (BetFour < 38 && BetFour >= 0)
418. {
419. if (BetFour == 37)
420. {
421.   printf("Your fourth bet number is 00 \n");
422.   }
423. else
424. {
425.   printf("Your fourth bet number is %d \n", BetFour);
426.   }
427. printf("Your bet is £%.2f \n", BetFourAmount);
428.
429. if (ResultFour == 37)
430. {
431.   printf("The fourth winning bet number is 00 \n");
432. }
433. else
434. {
435.   printf("The fourth winning bet number is %d \n", ResultFour);
436. }
437.
438. if (BetFour == ResultFour)
439. {
440.   PayFour=(BetFour*multi);
441.   PayTotal=(PayTotal+PayFour+BetFour);
442.   printf("WINNER! Your payout for your fourth bet is £%.2f \n", PayFour+BetFour);
443.   printf("Your subtotal is £%.2f \n", PayTotal);
444.
445.   }
446. else
447. {
448.   PayFour=(BetFourAmount);
449.   PayTotal=(PayTotal-PayFour);
450.   printf("LOSER! For your fourth bet, you have lost an amoout of -£%.2f \n", PayFour);
451.   printf("Your subtotal is £%.2f \n \n \n", PayTotal);
452.
453.   }
454.   }
455. else
456. {
457. printf("The fourth bet number entered is out of range, please try again within the range of 0-36, or enter 37 to place a bet on 00. \n \n \n");
458.
459.    }
460.
461. printf("Your Total earnings from these 4 bets are: £%.2f \n \n \n", PayTotal);
462. printf("Thank you for playing. We hope to see you again soon");
463.
464.
465.
466. }