<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2.     #include<time.h>
  3.     #include<stdlib.h>
  4.     int main (void)
  5.     {
  6.     int CashBet1;
  7.     int CashBet2;
  8.     int CashBet3;
  9.     int CashBet4;
  10.     /*These are the integers i am using for the ammount of cash the player wishes to bet */
  11.     int NumberBet1;
  12.     int NumberBet2;
  13.     int NumberBet3;
  14.     int NumberBet4;
  15.     /*I use the NumberBet integers for the number on the roulette board the player wishes to bet on */
  16.     int RouletteRoll1;
  17.     int RouletteRoll2;
  18.     int RouletteRoll3;
  19.     int RouletteRoll4;
  20.     /* These integers are used for each simulation of the 4 bets */
  21.     float Wheel[38] = {00, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36};
  22. /* This is the array I use to place the roulette board numbers. Which is needed for the 00 and 0*/
  23.     srand( time( 0 ) );
  24.    
  25.     RouletteRoll1 = rand() % 38;
  26.     RouletteRoll2 = rand() % 38;
  27.     RouletteRoll3 = rand() % 38;
  28.     RouletteRoll4 = rand() % 38;
  29.     /*These are the roulette spins used to that I use for each of the bets.
  30.     The random feature is used to ensure the wheel spin is random like in the real game
  31.     The Random number is capped at 38 to ensure all numbers from 00 and 0 to 38 are covered*/
  32.    
  33.     printf("Hello and Welcome to my Roulette simulator\n");
  34.     printf("Please enter 8 numbers 4 of which being the number on the roulette table\n and 4 of which being the cash value you wish to bet \n\n Table Limits are 50 \n");
  35.     printf("Enter the value of the first bet followed by the number on the wheel you wish to choose on the first bet then the same for the second third and forth\n\n\n");
  36.     scanf("%d %d", &CashBet1, &NumberBet1);
  37.     scanf("%d %d", &CashBet2, &NumberBet2);
  38.     scanf("%d %d", &CashBet3, &NumberBet3);
  39.     scanf("%d %d", &CashBet4, &NumberBet4);
  40.     /* This is used to scan the players input numbers for the value of the cash bet
  41.     and value of the number on the roulette wheel the players chooses*/
  42.    
  43.     if (CashBet1>50){
  44.     printf("Your first bet is too high\n");
  45.     }
  46.     /*This if statement is used to ensure the players cant enter a bet over 50 */
  47.     else if (NumberBet1>37) {
  48.     printf("You need to enter a number between 00 and 37 on your first bet\n");
  49.     }
  50.     /* This else if statement is used to ensure the players enters a number between 0 and 37
  51.     which represent the 38 numbers on the board from 00 and 0-36 */
  52.     else{
  53.     printf("Your Bets are %d on number %d\n ", CashBet1, NumberBet1);
  54.     }
  55.     /*This else statement is used to show the players bet and number chosen*/
  56.    
  57.    if (CashBet2>50){
  58.     printf("Your second bet is too high\n");
  59.     }
  60.     else if (NumberBet2>37) {
  61.     printf("You need to enter a number between 00 and 37 on your second bet\n");
  62.     }
  63.     else{
  64.     printf("Your Bets are %d on number %d\n ", CashBet2, NumberBet2);
  65.     }
  66.    
  67.     if (CashBet3>50){
  68.     printf("Your third bet is too high\n");
  69.     }
  70.     else if (NumberBet3>37) {
  71.     printf("You need to enter a number between 00 and 37 on your third bet\n");
  72.     }
  73.     else{
  74.     printf("Your Bets are %d on number %d\n ", CashBet3, NumberBet3);
  75.     }
  76.    
  77.    if (CashBet4>50){
  78.     printf("Your 4th bet is too high\n\n");
  79.     }
  80.     else if (NumberBet4>37) {
  81.     printf("You need to enter a number between 00 and 37 on your 4th bet \n\n");
  82.     }
  83.     else{
  84.     printf("Your Bets are %d on number %d \n\n ", CashBet4, NumberBet4);
  85.     }
  86.    
  87.    
  88.  
  89.     if (RouletteRoll1==NumberBet1){
  90.     printf("Your first bet won %d\n", CashBet1*35) ;
  91.     }
  92.     /* This if statement is used to show if a players bet has won */
  93.     else {
  94.     printf(" Your first bet lost\n");
  95.     }
  96.     /* This else statement is used to show if a players bet has lost*/
  97.    
  98.    if (RouletteRoll2==NumberBet2){
  99.     printf("Your second bet won %d\n", CashBet2*35) ;
  100.     }
  101.     else {
  102.     printf(" Your second bet lost\n");
  103.     }
  104.    
  105.    if (RouletteRoll3==NumberBet3){
  106.     printf("Your third bet won %d\n", CashBet3*35) ;
  107.     }
  108.     else {
  109.     printf(" You third lost\n");
  110.     }
  111.  
  112.   if (RouletteRoll4==NumberBet4){
  113.     printf("Your forth bet won %d \n", CashBet4*35) ;
  114.     }
  115.     else {
  116.     printf(" Your forth lost\n");
  117.     }
  118.    
  119.    printf("The winning numbers on each spin were %d %d %d %d", RouletteRoll1, RouletteRoll2, RouletteRoll3, RouletteRoll4);
  120.     /* This is used to show the winning numbers on each spin*/
  121.     }