<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3. Set Values of all Bets to Zero
  4. Set Values of all Bet Amounts to Zero
  5. Read user Input for First bet, Bet Number, Amount bet
  6. Read user Input for Second bet, Bet Number, Amount bet
  7. Read user Input for Third bet, Bet Number, Amount bet
  8. Read user Input for Fourth bet, Bet Number, Amount bet
  9.  
  10. IF no bet or bet amounts have been placed
  11. THEN
  12.   Display Error message “Please Enter in a legal Bet Number or Amount”
  13.    END IF
  14.    
  15. IF Plater enters in the two or more of the same bets
  16. THEN
  17.   Display Error message "Illogical betting, Please ensure that all bets are individual"
  18.    END IF
  19.  
  20. IF Player enters a bet number less than zero
  21. THEN
  22.   Display Error message "Error number Specific bet number is less than 0, Bets need to be from 0 to 37"
  23.    END IF
  24.  
  25. IF Player enters a bet amount of 0 or less
  26. THEN
  27.   Display Error message "Please Enter in a legal Number Specific Bet number amount"
  28.    END IF
  29.  
  30. IF Player enters in a bet number over the number of 37
  31. THEN
  32.   Display Error message "Error Illegal Bet, Please Place a Number Specific Bet that is 37 or less"
  33.    END IF
  34.  
  35. IF Player enters in four correct bet numbers and four correct bet amounts on any available number
  36. THEN
  37.   Generate random number
  38.   END IF
  39.  
  40. Display Winning number
  41. Display Bet number
  42. Display Bet Amount
  43.  
  44. IF Player wins a bet on any number
  45. THEN
  46.   Display message “Congratulations you have appeared to have Won £”
  47.    END IF
  48.  
  49. Else
  50. If Player loses a bet on any number
  51.   THEN
  52.    Display message “Commiserations Unfortunately you havent won this time”
  53.     END IF
  54.  
  55. IF betn1 wins, but bets 2,3,4 looses
  56. THEN
  57.    Display message "Total amount of money mades is:"
  58.     Display Subtotal
  59.      END IF
  60.  
  61. IF betn2 wins, but bets 1,3,4 looses
  62. THEN
  63.   Display message "Total amount of money mades is:"
  64.    Display Subtotal
  65.     END IF
  66.  
  67. IF betn3 wins, but bets 1,2,4 looses
  68. THEN
  69.   Display message "Total amount of money mades is:"
  70.    Display Subtotal
  71.     END IF
  72.  
  73. IF betn4 wins, but bets 1,2,3 looses
  74. THEN
  75.   Display message "Total amount of money mades is:"
  76.    Display Subtotal
  77.     END IF
  78.    
  79. Display Total amount of money bet
  80. Display Total amount won after the lost bet amounts have been subtracted
  81. Add the Winning bet numbers bet amount, display Total amount Won
  82.  
  83. Else
  84. IF player looses all four bets
  85. THEN
  86.   Display message "Total amount of Money lost is:"
  87.    END Else
  88. END
  89. */
  90. #include <stdio.h>
  91. #include <stdlib.h>
  92. #include <time.h>
  93. int main (void)
  94. {
  95. int betn1;
  96. int beta1;
  97. int betn2;
  98. int beta2;
  99. int betn3;
  100. int beta3;
  101. int betn4;
  102. int beta4;
  103. int betatotal;
  104. int Total1;
  105. int Total2;
  106. int Total3;
  107. int Total4;
  108. int Total_1;
  109. int Total_2;
  110. int Total_3;
  111. int Total_4;
  112. int Total_Payout1;
  113. int Total_Payout2;
  114. int Total_Payout3;
  115. int Total_Payout4;
  116. int number;
  117. int Red;
  118. int Black;
  119.  
  120. scanf("%d %d", &betn1, &beta1);/*Here is where all of my bet numbers and bet amounts will be searhced for during the process of the code*/
  121. scanf("%d %d", &betn2, &beta2);
  122. scanf("%d %d", &betn3, &beta3);
  123. scanf("%d %d", &betn4, &beta4);
  124. if (beta1 <= 0)
  125. {
  126. printf("Error: Please Enter in a Legal First Bet Amount \n");/*Here is where all fo my error messages for entering in bet amounts of a minus number*/
  127. exit(0);
  128. }
  129. if (beta2 <= 0)
  130. {
  131. printf("Error: Please Enter in a Legal Second Bet Amount \n");
  132. exit(0);
  133. }
  134. if (beta3 <= 0)
  135. {
  136. printf("Error: Please Enter in a Legal Third Bet Amount \n");
  137. exit(0);
  138. }
  139. if (beta4 <= 0)
  140. {
  141. printf("Error: Please Enter in a Legal Fourth Bet Amount \n");
  142. exit(0);
  143. }
  144. if (betn1 > 37)
  145. {
  146. printf("Error: Illegal Bet, Please Place a First Bet that is 37 or less");/*This part of the code is where the Error message for entering in bet numbers over 37*/
  147. exit(0);
  148. }
  149. if (betn2 > 37)
  150. {
  151. printf("Error: Illegal Bet, Please Place a Second bet that is 37 or less");
  152. exit(0);
  153. }
  154. if (betn3 > 37)
  155. {
  156. printf("Error: Illegal Bet, Please Place a Third bet that is 37 or less");
  157. exit(0);
  158. }
  159. if (betn4 > 37){
  160. printf("Error: Illegal Bet, Please Place a Fourth bet that is 37 or less");
  161. exit(0);
  162. }
  163. if (betn1 < 0)
  164. {
  165. printf("Error: First Bet is less than 0, Bets need to be from 0 to 37");/*This part of the code is where the Error message for entering in negative bets are displayed*/
  166. exit(0);
  167. }
  168. if (betn2 < 0)
  169. {
  170. printf("Error: Second Bet is less than 0, Bets need to be from 0 to 37");
  171. exit(0);
  172. }
  173. if (betn3 < 0)
  174. {
  175. printf("Error: Third Bet is less than 0, Bets need to be from 0 to 37");
  176. exit(0);
  177. }
  178. if (betn4 < 0)
  179. {
  180. printf("Error: Fourth Bet is less than 0, Bets need to be from 0 to 37");
  181. exit(0);
  182. }
  183. if (betn1 == betn2 || betn1 == betn3 || betn1 == betn4){
  184. printf("Error: Illogical betting, Please ensure that all bets are individual");/*If a player enters in two or more of the same bet number this part of the code will detect and display an error message*/
  185. exit(0);
  186. }
  187. else if (betn2 == betn1 || betn2 == betn3 || betn2 == betn4){
  188. printf("Error: Illogical betting, Please ensure that all bets are individual");
  189. exit(0);
  190. }
  191. else if (betn3 == betn1 || betn3 == betn2 || betn3 == betn4){
  192. printf("Error: Illogical betting, Please ensure that all bets are individual");
  193. exit(0);
  194. }
  195. else if (betn4 == betn1 || betn4 == betn2 || betn4 == betn3){
  196. printf("Error: Illogical betting, Please ensure that all bets are individual");
  197. exit(0);
  198. }
  199. srand ( time (0));/*Here is where the random number for the roulette wheel will be created and then later displayed, here the number 37 will be representing 00*/
  200. number = rand() % 38;/*This will stop the random number generator from going above 38*/
  201. printf("%d",number);
  202.  
  203. switch(number)/*Here is where if the number 0 is the random number it will display Green after the number*/
  204. { case 0: case 37:
  205. printf(" Green Is The Winning Spin \n", number);
  206. default:
  207. break;
  208. }
  209. switch(number)/*Here is where if any of these numbers are displayed as the random number it will display Black after the number*/
  210. { case 2case 4: case 6: case 8: case 10: case 11: case 13: case 15: case 17: case 20: case 22: case 24: case 26: case 28: case 29: case 31: case 33: case 35:
  211. printf(" Black Is The Winning Spin \n", number);
  212. default:
  213. break;
  214. }
  215. switch(number)/*Here is where if any of these numbers are displayed as the random number it will display Red after the number*/
  216. { case 1: case 3: case 5: case 7: case 9: case 12: case 14: case 16: case 18: case 19: case 21: case 23: case 25: case 27: case 30: case 32: case 34: case 36:
  217. printf(" Red Is The Winning Spin \n", number);
  218. default:
  219. break;
  220. }
  221. scanf("%d%d%d%d", &betn1, &betn2, &betn3, &betn4);/*Here is where all of my bets are scanned and displayed later in the output display*/
  222. {
  223. scanf("%d%d%d%d", &beta1, &beta2, &beta3, &beta4);/*Here is where all of my bet ammounts are scanned and displayed later in the output display*/
  224. }
  225. if (betn1 == number)/*Here is where my calculations for displaying if my bets have Won or Lost*/
  226. {
  227. Total1=beta1*35;
  228. printf("Bet Number 1: %d. \n", betn1);
  229. printf("Bet Amount 1: $%d. \n", beta1);
  230. printf("Congratulations your First bet has appeared to have WON\n");
  231. printf("Bet Number 1 has Won you: $%d.00 \n", Total1);/*Here is where the calculation for displaying the amount of money made and where the calculation for the subtotal is done, This is the same process for the following Three bets*/
  232. printf("Subtotal is: $%d.00\n", Total1);
  233.   }
  234.     else
  235.   {
  236. Total1=beta1*(-1);
  237. printf("Bet number 1: %d. \n", betn1);
  238. printf("Bet Amount 1: $%d. \n", beta1);
  239. printf("Commisorations your First bet hasn't won this time\n");
  240. printf("Bet Number 1 has Lost you: $%d.00 \n", beta1);/*Here is where the calculation for displaying the amount of money that has been Lost and where the ccalculation for the subtotal is done, This is the same process for the following Three bets*/
  241. printf("Subtotal is: $%d.00\n", Total1);
  242.  }
  243. if (betn2 == number){
  244. Total2=beta2*35;
  245. printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
  246. printf("Bet Number 2: %d. \n", betn2);
  247. printf("Bet Amount 2: $%d. \n", beta2);
  248. printf("Congratulations your Second bet has appeared to have WON\n");
  249. printf("Bet Number 2 has Won you: $%d.00 \n", Total2);
  250. printf("New Subtotal is: $%d.00\n", Total1+Total2);
  251.  }else{
  252.  Total2=beta2*(-1);
  253. printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
  254. printf("Bet Number 2: %d. \n", betn2);
  255. printf("Bet Amount 2: $%d. \n", beta2);
  256. printf("Commisorations your Second bet hasn't won this time\n");
  257. printf("Bet Number 2 has Lost you: $%d.00 \n", beta2);
  258. printf("New Subtotal is: $%d.00\n", Total1+Total2);
  259. }
  260.  
  261. if (betn3 == number){
  262. Total3=beta3*35;
  263. printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
  264. printf("Bet Number 3: %d. \n", betn3);
  265. printf("Bet Amount 3: $%d. \n", beta3);
  266. printf("Congratulations your Third bet has appeared to have WON\n");
  267. printf("Bet Number 3 has Won you: $%d.00 \n", Total3);
  268. printf("New Subtotal is: $%d.00\n", Total1+Total2+Total3);
  269.   }else{
  270. Total3=beta3*-1;
  271. printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  \n");
  272. printf("Bet Number 3: %d. \n", betn3);
  273. printf("Bet Amount 3: $%d \n", beta3);
  274. printf("Commisorations your Third bet hasn't won this time\n");
  275. printf("Bet Number 3 has Lost you: $%d.00 \n", beta3);
  276. printf("New Subtotal is: $%d.00\n", Total1+Total2+Total3);
  277. }
  278.  
  279. if (betn4 == number)
  280. {
  281. Total4=beta4*35;
  282. printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
  283. printf("Bet Number 4: %d. \n", betn4);
  284. printf("Bet Amount 4: $%d. \n", beta4);
  285. printf("Congratulations your Fourth bet has appeared to have WON\n");
  286. printf("Bet Number 4 has Won you: $%d.00 \n", Total4);
  287. printf("New Subtotal is: $%d.00\n", Total1+Total2+Total3+Total4);
  288. }
  289.     else
  290. {
  291. Total4=beta4*(-1);
  292. printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
  293. printf("Bet Number 4: %d. \n", betn4);
  294. printf("Bet Amount 4: $%d. \n", beta4);
  295. printf("Commisorations your Fourth bet hasn't won this time\n");
  296. printf("Bet Number 4 has Lost you: $%d.00 \n", beta4);
  297. printf("New Subtotal is: $%d.00\n", Total1+Total2+Total3+Total4);
  298. }
  299. printf("\nResult:\nTotal Amount of money placed on bets: $%d.00", beta1+beta2+beta3+beta4);/*Here is where all of my total bet amounts are added up and displayed as a total*/
  300. {
  301. if (betn1 == number &&betn2 != "" &&betn3 != ""  &&betn4 != ""){
  302. printf("\nTotal New Amount of money made after all bets : $%d.00", Total_Payout1=Total1+Total2+Total3+Total4);/*Here is where the Total amounts of profit and loss will, be calculated and displayed, The folowing code will represent when a specific number wins and the rest loose*/
  303. }
  304. else if (betn2 == number &&betn1 != "" &&betn3 != "" &&betn4 != ""){
  305. printf("\nTotal New Amount of money made after all bets: $%d.00", Total_Payout2=Total2+Total1+Total3+Total4);
  306. }
  307. else if (betn3 == number &&betn1 != "" &&betn2 != "" &&betn4 != ""){
  308. printf("\nTotal New Amount of money made after all bets: $%d.00", Total_Payout3=Total3+Total1+Total2+Total4);
  309. }
  310. else if (betn4 == number &&betn1 != "" &&betn2 != "" &&betn3 != ""){
  311. printf("\nTotal New Amount of money made after all bets: $%d.00", Total_Payout4=Total4+Total1+Total2+Total3);
  312. }
  313. if (betn1 == number &&betn2 != "" &&betn3 != ""  &&betn4 != ""){
  314. printf("\nTotal Amount made with the Stake/bet Amount: $%d.00", Total_Payout1+beta1);/*Here the Program will display the total amount Won and then add the bet amount for the bet that won*/
  315. }
  316. else if (betn2 == number &&betn1 != "" &&betn3 != "" &&betn4 != ""){
  317. printf("\nTotal Amount made with the Stake/bet Amount: $%d.00", Total_Payout2+beta2);
  318. }
  319. else if (betn3 == number &&betn1 != "" &&betn2 != "" &&betn4 != ""){
  320. printf("\nTotal Amount made with the Stake/bet Amount: $%d.00", Total_Payout3+beta3);
  321. }
  322. else if (betn4 == number &&betn1 != "" &&betn2 != "" &&betn3 != ""){
  323. printf("\nTotal Amount made with the Stake/bet Amount: $%d.00", Total_Payout4+beta4);
  324. }
  325. else
  326. {
  327.  printf("\nYour Total amount of Money Lost is: $%d.00", beta1*-1+beta2*-1+beta3*-1+beta4*-1);/*Here the calculation for the amount of money you have lost will be counted and displayed*/
  328. }
  329. }
  330. }