<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3.    Get the four input values of bet amount
  4.    Get the four input values of the board numbers
  5.    Generate a randon number
  6.    Disply the values that has been bet
  7.    Generate random number between 0 to 38
  8.    IF bet amount is negative
  9.      Display ERROR message that bet amount is negative
  10.     ELSE
  11.      IF input value is the same as the randomly generated number
  12.          Display winning message and amount won which is 37 multiplied by bet amount
  13.          Add won amount to total winnings amount
  14.        Else IF input values is red
  15.           IF randomly genrated number is any of 1, 3, 5, 7, 9, 12,14, 16, 18, 19, 21, 23,25, 27, 30, 32, 34, 36
  16.            Display bet won and the amount won which is 2 multiplied by bet amount
  17.           ELSE
  18.            Display bet lost
  19.        Else IF input values is balck
  20.           IF randomly genrated number is any of 2, 4, 6, 8, 10, 11,13, 15, 17, 20, 22, 24,26, 28, 29, 31, 33, 35
  21.            Display bet won and the amount won which is 2 multiplied by bet amount
  22.           ELSE
  23.            Display bet lost
  24.        Else
  25.          Display error message the board value is out of range
  26. */
  27.  
  28.  
  29. #include <stdio.h>
  30. #include <string.h>
  31. #include <stdlib.h>
  32.  
  33. int main(void)                                                                    /* start of main function*/
  34. {
  35.    char board1[2] = { '\0' };                                                     /* set up array of lenght 2*/
  36.    char board2[2] = { '\0' };
  37.    char board3[2] = { '\0' };
  38.    char board4[2] = { '\0' };
  39.    float bet[4];
  40.    int numberR = 0;                                                               /* declear and set numberR to zero*/
  41.    char randomChar[2];
  42.    float totalwin = 0;
  43.  
  44.    
  45.    scanf("%s %f %s %f %s %f %s %f",&board1,&bet[0],&board2,&bet[1],&board3,&bet[2],&board4,&bet[3]); /* Get all input values*/
  46.    
  47.    srand (time(NULL));
  48.    numberR = (rand()%38);                                                         /*Generate a random number*/
  49.  
  50. if(bet[0]<0)                                                                      /*Error check to see if bet amount is a negative number*/
  51. {
  52.  printf("Bet value is negative on board one ERROR\n");
  53. }   
  54. else                           
  55. {
  56. printf("Your first bet was on %s\n",board1);                                       /*display where your first bet was placed*/
  57.    
  58. int result1 = atoi(board1);                                                        /*convert board1 from a string to a number and store value in result1*/
  59.  
  60.  if(result1 < 0)                                                                   /*error check to see if board amount was a negative number*/
  61.    {
  62.    printf("ERROR input value is negative\n");                                      /*display error message*/
  63.    }
  64.   if (numberR == 38)                                                               /*this if statment is to set apart 00 from the other numerical results*/
  65.      {
  66.      printf("The ball landed on double zero \n");
  67.       if ( strcmp(board1, "00") == 0 )                                             /*this function compares two strings and if they equal 0 the proceed to display function*/
  68.       {
  69.         totalwin = (totalwin + bet[0]*37);                                         /*adds the winning amounts to total bet amounts*/
  70.         printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37)); /* display statment recording winnins*/
  71.       }
  72.       else
  73.       {
  74.         printf("You lost on the first board lossing %.2f\n", bet[0]);              /*display statment lossing*/
  75.       }
  76.       } 
  77.   else if (strcmp(board1, "RED") == 0)                                             /* compare two strings of charictors for red */
  78.      
  79.       {
  80.        if(numberR == 1||numberR == 3||numberR == 5||numberR == 7||numberR == 9||numberR == 12||numberR == 14||numberR == 16||numberR == 18||numberR == 19||numberR == 21||numberR == 23||numberR == 25||numberR == 27||numberR == 30||numberR == 32||numberR == 34||numberR == 36)
  81.        {
  82.          printf("You won %.2f on your first bet on RED\n", (bet[0]*2));
  83.          totalwin = (totalwin + bet[0]*2);                                          /* Add winnings to total winnings*/
  84.         }
  85.          else
  86.          {
  87.          printf("You lost %.2f on your first bet on RED\n", bet[0]);
  88.        }
  89.        } 
  90.   else if (strcmp(board1, "BLA") == 0)                                             /* compare two strings of charictors for red */     
  91.      
  92.       {
  93.        if(numberR == 2||numberR == 4||numberR == 6||numberR == 8||numberR == 10||numberR == 11||numberR == 13||numberR == 15||numberR == 17||numberR == 20||numberR == 22||numberR == 24||numberR == 26||numberR == 28||numberR == 29||numberR == 31||numberR == 33||numberR == 35)
  94.        {
  95.          printf("You won %.2f on your first bet on Black\n", (bet[0]*2));          /* this function displays the amount you have won */
  96.          totalwin = (totalwin + bet[0]*37);
  97.         }
  98.          else
  99.          {
  100.          printf("You lost %.2f on your first bet on BLACK\n", bet[0]);
  101.        }
  102.        }
  103.      
  104.     else if (result1 == numberR)                                                   /*this statment is used to see if you have won in numbers 0 to 37*/
  105.      {
  106.      if(result1>37)
  107.      {
  108.      printf("Error number entered out of range");                                  /* display error statment*/
  109.      }
  110.      
  111.       switch(result1)                                                              /* switch statements are used to cut down the number of if statments and for number between 0 to 37*/
  112.       {
  113.        case 0 :                                                                    /* if result1 is 0 then print winning statment */
  114.          printf("The ball landed on Number 0\n" );
  115.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  116.          totalwin = (totalwin + bet[0]*37);
  117.          break;
  118.        case 1 :
  119.          printf("The ball landed on Number 1\n" );
  120.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  121.          totalwin = (totalwin + bet[0]*37);
  122.          break;   
  123.        case 2 :
  124.          printf("The ball landed on Number 2\n" );
  125.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  126.          totalwin = (totalwin + bet[0]*37);
  127.          break;
  128.        case 3 :
  129.          printf("The ball landed on Number 3\n" );
  130.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  131.          totalwin = (totalwin + bet[0]*37);
  132.          break;
  133.        case 4 :
  134.          printf("The ball landed on Number 4\n" );
  135.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  136.          totalwin = (totalwin + bet[0]*37);
  137.          break;
  138.        case 5:
  139.          printf("The ball landed on Number 5\n" );
  140.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  141.          totalwin = (totalwin + bet[0]*37);
  142.          break;
  143.        case 6 :
  144.          printf("The ball landed on Number 6\n" );
  145.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  146.          totalwin = (totalwin + bet[0]*37);
  147.          break;   
  148.        case 7 :
  149.          printf("The ball landed on Number 7\n" );
  150.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  151.          totalwin = (totalwin + bet[0]*37);
  152.          break;
  153.        case 8 :
  154.          printf("The ball landed on Number 8\n" );
  155.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  156.          totalwin = (totalwin + bet[0]*37);
  157.          break;
  158.        case 9:
  159.          printf("The ball landed on Number 9\n" );
  160.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  161.          totalwin = (totalwin + bet[0]*37);
  162.          break;
  163.        case 10:
  164.          printf("The ball landed on Number 10\n" );
  165.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  166.          totalwin = (totalwin + bet[0]*37);
  167.          break;
  168.        case 11 :
  169.          printf("The ball landed on Number 11\n" );
  170.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  171.          totalwin = (totalwin + bet[0]*37);
  172.          break;   
  173.        case 12 :
  174.          printf("The ball landed on Number 12\n" );
  175.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  176.          totalwin = (totalwin + bet[0]*37);
  177.          break;
  178.        case 13 :
  179.          printf("The ball landed on Number 13\n" );
  180.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  181.          totalwin = (totalwin + bet[0]*37);
  182.          break;
  183.        case 14 :
  184.          printf("The ball landed on Number 14\n" );
  185.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  186.          totalwin = (totalwin + bet[0]*37);
  187.          break;
  188.        case 15:
  189.          printf("The ball landed on Number 15\n" );
  190.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  191.          totalwin = (totalwin + bet[0]*37);
  192.          break;
  193.        case 16 :
  194.          printf("The ball landed on Number 16\n" );
  195.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  196.          totalwin = (totalwin + bet[0]*37);
  197.          break;   
  198.        case 17 :
  199.          printf("The ball landed on Number 17\n" );
  200.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  201.          totalwin = (totalwin + bet[0]*37);
  202.          break;
  203.        case 18 :
  204.          printf("The ball landed on Number 18\n" );
  205.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  206.          totalwin = (totalwin + bet[0]*37);
  207.          break;
  208.        case 19:
  209.          printf("The ball landed on Number 19\n" );
  210.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  211.          totalwin = (totalwin + bet[0]*37);
  212.          break;
  213.        case 20:
  214.          printf("The ball landed on Number 20\n" );
  215.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  216.          totalwin = (totalwin + bet[0]*37);
  217.          break;
  218.        case 21 :
  219.          printf("The ball landed on Number 21\n" );
  220.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  221.          totalwin = (totalwin + bet[0]*37);
  222.          break;   
  223.        case 22 :
  224.          printf("The ball landed on Number 22\n" );
  225.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  226.          totalwin = (totalwin + bet[0]*37);
  227.          break;
  228.        case 23 :
  229.          printf("The ball landed on Number 23\n" );
  230.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  231.          totalwin = (totalwin + bet[0]*37);
  232.          break;
  233.        case 24 :
  234.          printf("The ball landed on Number 24\n" );
  235.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  236.          totalwin = (totalwin + bet[0]*37);
  237.          break;
  238.        case 25:
  239.          printf("The ball landed on Number 25\n" );
  240.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  241.          totalwin = (totalwin + bet[0]*37);
  242.          break;
  243.        case 26 :
  244.          printf("The ball landed on Number 26\n" );
  245.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  246.          totalwin = (totalwin + bet[0]*37);
  247.          break;   
  248.        case 27 :
  249.          printf("The ball landed on Number 27\n" );
  250.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  251.          totalwin = (totalwin + bet[0]*37);
  252.          break;
  253.        case 28 :
  254.          printf("The ball landed on Number 28\n" );
  255.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  256.          totalwin = (totalwin + bet[0]*37);
  257.          break;
  258.        case 29:
  259.          printf("The ball landed on Number 29\n" );
  260.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  261.          totalwin = (totalwin + bet[0]*37);
  262.          break;
  263.        case 30:
  264.          printf("The ball landed on Number 30\n" );
  265.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  266.          totalwin = (totalwin + bet[0]*37);
  267.          break;
  268.        case 31 :
  269.          printf("The ball landed on Number 31\n" );
  270.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  271.          totalwin = (totalwin + bet[0]*37);
  272.          break;   
  273.        case 32 :
  274.          printf("The ball landed on Number 32\n" );
  275.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  276.          totalwin = (totalwin + bet[0]*37);
  277.          break;
  278.        case 33 :
  279.          printf("The ball landed on Number 33\n" );
  280.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  281.          totalwin = (totalwin + bet[0]*37);
  282.          break;
  283.        case 34 :
  284.          printf("The ball landed on Number 34\n" );
  285.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  286.          totalwin = (totalwin + bet[0]*37);
  287.          break;
  288.        case 35:
  289.          printf("The ball landed on Number 35\n" );
  290.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  291.          totalwin = (totalwin + bet[0]*37);
  292.          break;
  293.        case 36 :
  294.          printf("The ball landed on Number 36\n" );
  295.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  296.          totalwin = (totalwin + bet[0]*37);
  297.          break;   
  298.        case 37 :
  299.          printf("The ball landed on Number 17\n" );
  300.          printf("You won on your first board.\nWinnings are %.2f.\n",(bet[0]*37));
  301.          totalwin = (totalwin + bet[0]*37);
  302.          break;         
  303.        default :
  304.          printf("Error number entered is out of range\n" );
  305.          break;
  306.      }
  307.      }
  308.      else
  309.      {
  310.       if(result1>37)
  311.      {
  312.      printf("Error number entered out of range on board one");                             /* error checking for number greater than range*/
  313.      }
  314.      else
  315.      printf("The ball landed on %d\n",numberR);
  316.      printf("You lost your first bet.\nLossing %.2f.\n", bet[0]);
  317.      }
  318.      }
  319. if(bet[1]<0)
  320. {
  321.  printf("Bet value is negative on board two ERROR\n");                                      /* error checking for negative numbers */
  322. }   
  323. else
  324. {
  325.        
  326. printf("Your second bet was on %s\n",board2);
  327.    
  328. int result2 = atoi(board2);
  329.  
  330.  if(result2 < 0)
  331.    {
  332.    printf("ERROR input value is negative");
  333.    }
  334.   if (numberR == 38)
  335.      {
  336.      printf("The ball landed on double zero \n");
  337.       if ( strcmp(board2, "00") == 0 )
  338.       {
  339.         totalwin = (totalwin + bet[1]*37);
  340.         printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  341.       }
  342.       else
  343.       {
  344.         printf("You lost on the second board lossing %.2f\n", bet[1]);
  345.       }
  346.       } 
  347.   else if (strcmp(board2, "RED") == 0)
  348.      
  349.       {
  350.        if(numberR == 1||numberR == 3||numberR == 5||numberR == 7||numberR == 9||numberR == 12||numberR == 14||numberR == 16||numberR == 18||numberR == 19||numberR == 21||numberR == 23||numberR == 25||numberR == 27||numberR == 30||numberR == 32||numberR == 34||numberR == 36)
  351.        {
  352.          printf("You won %.2f on your second bet on RED\n", (bet[1]*2));
  353.          totalwin = (totalwin + bet[1]*2);
  354.         }
  355.          else
  356.          {
  357.          printf("You lost %.2f on your second bet on RED\n", bet[1]);
  358.        }
  359.        } 
  360.   else if (strcmp(board2, "BLA") == 0)
  361.      
  362.       {
  363.        if(numberR == 2||numberR == 4||numberR == 6||numberR == 8||numberR == 10||numberR == 11||numberR == 13||numberR == 15||numberR == 17||numberR == 20||numberR == 22||numberR == 24||numberR == 26||numberR == 28||numberR == 29||numberR == 31||numberR == 33||numberR == 35)
  364.        {
  365.          printf("You won %.2f on your second bet on Black\n", (bet[1]*2));
  366.          totalwin = (totalwin + bet[1]*37);
  367.         }
  368.          else
  369.          {
  370.          printf("You lost %.2f on your second bet on BLACK\n", bet[1]);
  371.        }
  372.        }
  373.      
  374.     else if (result2 == numberR)
  375.      {
  376.      if(result2 > 37)
  377.      {
  378.      printf("Error number entered out of range on the second board");
  379.      }
  380.       switch(result2)
  381.       {
  382.        case 0 :
  383.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  384.          totalwin = (totalwin + bet[1]*37);
  385.          break;
  386.        case 1 :
  387.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  388.          totalwin = (totalwin + bet[1]*37);
  389.          break;   
  390.        case 2 :
  391.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  392.          totalwin = (totalwin + bet[1]*37);
  393.          break;
  394.        case 3 :
  395.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  396.          totalwin = (totalwin + bet[1]*37);
  397.          break;
  398.        case 4 :
  399.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  400.          totalwin = (totalwin + bet[1]*37);
  401.          break;
  402.        case 5:
  403.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  404.          totalwin = (totalwin + bet[1]*37);
  405.          break;
  406.        case 6 :
  407.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  408.          totalwin = (totalwin + bet[1]*37);
  409.          break;   
  410.        case 7 :
  411.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  412.          totalwin = (totalwin + bet[1]*37);
  413.          break;
  414.        case 8 :
  415.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  416.          totalwin = (totalwin + bet[1]*37);
  417.          break;
  418.        case 9:
  419.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  420.          totalwin = (totalwin + bet[1]*37);
  421.          break;
  422.        case 10:
  423.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  424.          totalwin = (totalwin + bet[1]*37);
  425.          break;
  426.        case 11 :
  427.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  428.          totalwin = (totalwin + bet[1]*37);
  429.          break;   
  430.        case 12 :
  431.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  432.          totalwin = (totalwin + bet[1]*37);
  433.          break;
  434.        case 13 :
  435.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  436.          totalwin = (totalwin + bet[1]*37);
  437.          break;
  438.        case 14 :
  439.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  440.          totalwin = (totalwin + bet[1]*37);
  441.          break;
  442.        case 15:
  443.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  444.          totalwin = (totalwin + bet[1]*37);
  445.          break;
  446.        case 16 :
  447.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  448.          totalwin = (totalwin + bet[1]*37);
  449.          break;   
  450.        case 17 :
  451.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  452.          totalwin = (totalwin + bet[1]*37);
  453.          break;
  454.        case 18 :
  455.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  456.          totalwin = (totalwin + bet[1]*37);
  457.          break;
  458.        case 19:
  459.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  460.          totalwin = (totalwin + bet[1]*37);
  461.          break;
  462.        case 20:
  463.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  464.          totalwin = (totalwin + bet[1]*37);
  465.          break;
  466.        case 21 :
  467.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  468.          totalwin = (totalwin + bet[1]*37);
  469.          break;   
  470.        case 22 :
  471.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  472.          totalwin = (totalwin + bet[1]*37);
  473.          break;
  474.        case 23 :
  475.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  476.          totalwin = (totalwin + bet[1]*37);
  477.          break;
  478.        case 24 :
  479.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  480.          totalwin = (totalwin + bet[1]*37);
  481.          break;
  482.        case 25:
  483.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  484.          totalwin = (totalwin + bet[1]*37);
  485.          break;
  486.        case 26 :
  487.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  488.          totalwin = (totalwin + bet[1]*37);
  489.          break;   
  490.        case 27 :
  491.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  492.          totalwin = (totalwin + bet[1]*37);
  493.          break;
  494.        case 28 :
  495.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  496.          totalwin = (totalwin + bet[1]*37);
  497.          break;
  498.        case 29:
  499.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  500.          totalwin = (totalwin + bet[1]*37);
  501.          break;
  502.        case 30:
  503.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  504.          totalwin = (totalwin + bet[1]*37);
  505.          break;
  506.        case 31 :
  507.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  508.          totalwin = (totalwin + bet[1]*37);
  509.          break;   
  510.        case 32 :
  511.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  512.          totalwin = (totalwin + bet[1]*37);
  513.          break;
  514.        case 33 :
  515.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  516.          totalwin = (totalwin + bet[1]*37);
  517.          break;
  518.        case 34 :
  519.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  520.          totalwin = (totalwin + bet[1]*37);
  521.          break;
  522.        case 35:
  523.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  524.          totalwin = (totalwin + bet[1]*37);
  525.          break;
  526.        case 36 :
  527.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  528.          totalwin = (totalwin + bet[1]*37);
  529.          break;
  530.        case 37 :
  531.          printf("You won on your second board.\nWinnings are %.2f.\n",(bet[1]*37));
  532.          totalwin = (totalwin + bet[1]*37);
  533.          break;       
  534.        default :
  535.          printf("Error number entered is out of range on board two\n" );
  536.          break;
  537.      }
  538.      }
  539.      else
  540.      {
  541.       if(result2>37)
  542.      {
  543.      printf("Error number entered out of range on board second\n");
  544.      }
  545.      else
  546.      printf("You lost your second bet.\nLossing %.2f.\n", bet[1]);
  547.      }
  548.      }
  549. if(bet[2]<0)
  550. {
  551.  printf("Bet value is negative on board thrid ERROR\n");
  552. }   
  553. else
  554. {     
  555.      printf("Your third bet was on %s\n",board3);
  556.    
  557. int result3 = atoi(board3);
  558.  
  559.  if(result3 < 0)
  560.    {
  561.    printf("ERROR input value is negative on the third\n");
  562.    }
  563.   if (numberR == 38)
  564.      {
  565.      printf("The ball landed on double zero\n");
  566.       if ( strcmp(board3, "00") == 0 )
  567.       {
  568.         totalwin = (totalwin + bet[2]*37);
  569.         printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  570.       }
  571.       else
  572.       {
  573.         printf("You lost on the third board lossing %.2f\n", bet[2]);
  574.       }
  575.       } 
  576.   else if (strcmp(board3, "RED") == 0)
  577.      
  578.       {
  579.        if(numberR == 1||numberR == 3||numberR == 5||numberR == 7||numberR == 9||numberR == 12||numberR == 14||numberR == 16||numberR == 18||numberR == 19||numberR == 21||numberR == 23||numberR == 25||numberR == 27||numberR == 30||numberR == 32||numberR == 34||numberR == 36)
  580.        {
  581.          printf("You won %.2f on your third bet on RED\n", (bet[2]*2));
  582.          totalwin = (totalwin + bet[2]*2);
  583.         }
  584.          else
  585.          {
  586.          printf("You lost %.2f on your third bet on RED\n", bet[2]);
  587.        }
  588.        } 
  589.   else if (strcmp(board3, "BLA") == 0)
  590.      
  591.       {
  592.        if(numberR == 2||numberR == 4||numberR == 6||numberR == 8||numberR == 10||numberR == 11||numberR == 13||numberR == 15||numberR == 17||numberR == 20||numberR == 22||numberR == 24||numberR == 26||numberR == 28||numberR == 29||numberR == 31||numberR == 33||numberR == 35)
  593.        {
  594.          printf("You won %.2f on your third bet on Black\n", (bet[2]*2));
  595.          totalwin = (totalwin + bet[2]*37);
  596.         }
  597.          else
  598.          {
  599.          printf("You lost %.2f on your third bet on BLACK\n", bet[2]);
  600.        }
  601.        }
  602.      
  603.     else if (result3 == numberR)
  604.      {
  605.      if(result3 > 37)
  606.      {
  607.      printf("Error number entered out of range on the third board\n");
  608.      }
  609.      
  610.      for (int i = 0; i < 38; i++)
  611.      {
  612.       if (result3 == i)
  613.       {
  614.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  615.       }
  616.      
  617.            
  618.      }
  619.       switch(result3)
  620.       {
  621.        case 0 :
  622.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  623.          totalwin = (totalwin + bet[2]*37);
  624.          break;
  625.        case 1 :
  626.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  627.          totalwin = (totalwin + bet[2]*37);
  628.          break
  629.        case 2 :
  630.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  631.          totalwin = (totalwin + bet[2]*37);
  632.          break;
  633.        case 3 :
  634.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  635.          totalwin = (totalwin + bet[2]*37);
  636.          break;
  637.        case 4 :
  638.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  639.          totalwin = (totalwin + bet[2]*37);
  640.          break;
  641.        case 5:
  642.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  643.          totalwin = (totalwin + bet[2]*37);
  644.          break;
  645.        case 6 :
  646.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  647.          totalwin = (totalwin + bet[2]*37);
  648.          break;
  649.        case 7 :
  650.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  651.          totalwin = (totalwin + bet[2]*37);
  652.          break;
  653.        case 8 :
  654.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  655.          totalwin = (totalwin + bet[2]*37);
  656.          break;
  657.        case 9:
  658.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  659.          totalwin = (totalwin + bet[2]*37);
  660.          break;
  661.        case 10:
  662.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  663.          totalwin = (totalwin + bet[2]*37);
  664.          break;
  665.        case 11 :
  666.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  667.          totalwin = (totalwin + bet[2]*37);
  668.          break;   
  669.        case 12 :
  670.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  671.          totalwin = (totalwin + bet[2]*37);
  672.          break;
  673.        case 13 :
  674.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  675.          totalwin = (totalwin + bet[2]*37);
  676.          break;
  677.        case 14 :
  678.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  679.          totalwin = (totalwin + bet[2]*37);
  680.          break;
  681.        case 15:
  682.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  683.          totalwin = (totalwin + bet[2]*37);
  684.          break;
  685.        case 16 :
  686.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  687.          totalwin = (totalwin + bet[2]*37);
  688.          break;   
  689.        case 17 :
  690.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  691.          totalwin = (totalwin + bet[2]*37);
  692.          break;
  693.        case 18 :
  694.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  695.          totalwin = (totalwin + bet[2]*37);
  696.          break;
  697.        case 19:
  698.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  699.          totalwin = (totalwin + bet[2]*37);
  700.          break;
  701.        case 20:
  702.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  703.          totalwin = (totalwin + bet[2]*37);
  704.          break;
  705.        case 21 :
  706.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  707.          totalwin = (totalwin + bet[2]*37);
  708.          break;
  709.        case 22 :
  710.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  711.          totalwin = (totalwin + bet[2]*37);
  712.          break;
  713.        case 23 :
  714.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  715.          totalwin = (totalwin + bet[2]*37);
  716.          break;
  717.        case 24 :
  718.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  719.          totalwin = (totalwin + bet[2]*37);
  720.          break;
  721.        case 25:
  722.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  723.          totalwin = (totalwin + bet[2]*37);
  724.          break;
  725.        case 26 :
  726.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  727.          totalwin = (totalwin + bet[2]*37);
  728.          break;
  729.        case 27 :
  730.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  731.          totalwin = (totalwin + bet[2]*37);
  732.          break;
  733.        case 28 :
  734.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  735.          totalwin = (totalwin + bet[2]*37);
  736.          break;
  737.        case 29:
  738.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  739.          totalwin = (totalwin + bet[2]*37);
  740.          break;
  741.        case 30:
  742.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  743.          totalwin = (totalwin + bet[2]*37);
  744.          break;
  745.        case 31 :
  746.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  747.          totalwin = (totalwin + bet[2]*37);
  748.          break;   
  749.        case 32 :
  750.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  751.          totalwin = (totalwin + bet[2]*37);
  752.          break;
  753.        case 33 :
  754.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  755.          totalwin = (totalwin + bet[2]*37);
  756.          break;
  757.        case 34 :
  758.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  759.          totalwin = (totalwin + bet[2]*37);
  760.          break;
  761.        case 35:
  762.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  763.          totalwin = (totalwin + bet[2]*37);
  764.          break;
  765.        case 36 :
  766.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  767.          totalwin = (totalwin + bet[2]*37);
  768.          break;
  769.        case 37 :
  770.          printf("You won on your third board.\nWinnings are %.2f.\n",(bet[2]*37));
  771.          totalwin = (totalwin + bet[2]*37);
  772.          break;     
  773.        default :
  774.          printf("Error number entered is out of range on board three\n" );
  775.          break;
  776.      }
  777.      }
  778.      else
  779.      {
  780.       if(result3>37)
  781.      {
  782.      printf("Error number entered out of range on board three");
  783.      }
  784.      else
  785.      printf("You lost your third bet.\nLossing %.2f.\n", bet[2]);
  786.      }
  787.      }
  788. if(bet[3]<0)
  789. {
  790.  printf("Bet value is negative on board four ERROR\n");
  791. }   
  792. else
  793. {     
  794.      
  795.  int result4 = atoi(board4);
  796.  
  797.  if(result4 < 0)
  798.    {
  799.    printf("ERROR input value is negative on the fourth\n");
  800.    }
  801.   if (numberR == 38)
  802.      {
  803.      printf("The ball landed on double zero\n");
  804.       if ( strcmp(board4, "00") == 0 )
  805.       {
  806.         totalwin = (totalwin + bet[3]*37);
  807.         printf("You won on your fourth board.\nWinnings are %.2f.\n",(bet[3]*37));
  808.       }
  809.       else
  810.       {
  811.         printf("You lost on the fourth board lossing %.2f\n", bet[3]);
  812.       }
  813.       } 
  814.   else if (strcmp(board4, "RED") == 0)
  815.      
  816.       {
  817.        if(numberR == 1||numberR == 3||numberR == 5||numberR == 7||numberR == 9||numberR == 12||numberR == 14||numberR == 16||numberR == 18||numberR == 19||numberR == 21||numberR == 23||numberR == 25||numberR == 27||numberR == 30||numberR == 32||numberR == 34||numberR == 36)
  818.        {
  819.          printf("You won %.2f on your fourth bet on RED\n", (bet[3]*2));
  820.          totalwin = (totalwin + bet[3]*2);
  821.         }
  822.          else
  823.          {
  824.          printf("You lost %.2f on your fourth bet on RED\n", bet[3]);
  825.        }
  826.        } 
  827.   else if (strcmp(board4, "BLA") == 0)
  828.      
  829.       {
  830.        if(numberR == 2||numberR == 4||numberR == 6||numberR == 8||numberR == 10||numberR == 11||numberR == 13||numberR == 15||numberR == 17||numberR == 20||numberR == 22||numberR == 24||numberR == 26||numberR == 28||numberR == 29||numberR == 31||numberR == 33||numberR == 35)
  831.        {
  832.          printf("You won %.2f on your fourth bet on Black\n", (bet[3]*2));
  833.          totalwin = (totalwin + bet[3]*37);
  834.         }
  835.          else
  836.          {
  837.          printf("You lost %.2f on your fourth bet on BLACK\n", bet[2]);
  838.        }
  839.        }
  840.      
  841.     else if (result4 == numberR)
  842.      {
  843.      if(result4 > 37)
  844.      {
  845.      printf("Error number entered out of range on the fourth board\n");
  846.      }
  847.       switch(result4)
  848.       {
  849.        case 0 :
  850.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  851.          totalwin = (totalwin + bet[3]*37);
  852.          break;
  853.        case 1 :
  854.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  855.          totalwin = (totalwin + bet[3]*37);
  856.          break;
  857.        case 2 :
  858.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  859.          totalwin = (totalwin + bet[3]*37);
  860.          break;
  861.        case 3 :
  862.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  863.          totalwin = (totalwin + bet[3]*37);
  864.          break;
  865.        case 4 :
  866.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  867.          totalwin = (totalwin + bet[3]*37);
  868.          break;
  869.        case 5:
  870.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  871.          totalwin = (totalwin + bet[3]*37);
  872.          break;
  873.        case 6 :
  874.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  875.          totalwin = (totalwin + bet[3]*37);
  876.          break;
  877.        case 7 :
  878.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  879.          totalwin = (totalwin + bet[3]*37);
  880.          break;
  881.        case 8 :
  882.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  883.          totalwin = (totalwin + bet[3]*37);
  884.          break;
  885.        case 9:
  886.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  887.          totalwin = (totalwin + bet[3]*37);
  888.          break;
  889.        case 10:
  890.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  891.          totalwin = (totalwin + bet[3]*37);
  892.          break;
  893.        case 11 :
  894.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  895.          totalwin = (totalwin + bet[3]*37);
  896.          break;
  897.        case 12 :
  898.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  899.          totalwin = (totalwin + bet[3]*37);
  900.          break;
  901.        case 13 :
  902.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  903.          totalwin = (totalwin + bet[3]*37);
  904.          break;
  905.        case 14 :
  906.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  907.          totalwin = (totalwin + bet[3]*37);
  908.          break;
  909.        case 15:
  910.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  911.          totalwin = (totalwin + bet[3]*37);
  912.          break;
  913.        case 16 :
  914.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  915.          totalwin = (totalwin + bet[3]*37);
  916.          break
  917.        case 17 :
  918.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  919.          totalwin = (totalwin + bet[3]*37);
  920.          break;
  921.        case 18 :
  922.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  923.          totalwin = (totalwin + bet[3]*37);
  924.          break;
  925.        case 19:
  926.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  927.          totalwin = (totalwin + bet[3]*37);
  928.          break;
  929.        case 20:
  930.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  931.          totalwin = (totalwin + bet[3]*37);
  932.          break;
  933.        case 21 :
  934.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  935.          totalwin = (totalwin + bet[3]*37);
  936.          break;
  937.        case 22 :
  938.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  939.          totalwin = (totalwin + bet[3]*37);
  940.          break;
  941.        case 23 :
  942.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  943.          totalwin = (totalwin + bet[3]*37);
  944.          break;
  945.        case 24 :
  946.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  947.          totalwin = (totalwin + bet[3]*37);
  948.          break;
  949.        case 25:
  950.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  951.          totalwin = (totalwin + bet[3]*37);
  952.          break;
  953.        case 26 :
  954.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  955.          totalwin = (totalwin + bet[3]*37);
  956.          break;
  957.        case 27 :
  958.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  959.          totalwin = (totalwin + bet[3]*37);
  960.          break;
  961.        case 28 :
  962.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  963.          totalwin = (totalwin + bet[3]*37);
  964.          break;
  965.        case 29:
  966.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  967.          totalwin = (totalwin + bet[3]*37);
  968.          break;
  969.        case 30:
  970.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  971.          totalwin = (totalwin + bet[3]*37);
  972.          break;
  973.        case 31 :
  974.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  975.          totalwin = (totalwin + bet[3]*37);
  976.          break
  977.        case 32 :
  978.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  979.          totalwin = (totalwin + bet[3]*37);
  980.          break;
  981.        case 33 :
  982.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  983.          totalwin = (totalwin + bet[3]*37);
  984.          break;
  985.        case 34 :
  986.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  987.          totalwin = (totalwin + bet[3]*37);
  988.          break;
  989.        case 35:
  990.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  991.          totalwin = (totalwin + bet[3]*37);
  992.          break;
  993.        case 36 :
  994.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  995.          totalwin = (totalwin + bet[3]*37);
  996.          break;
  997.        case 37 :
  998.          printf("You won on your forth board.\nWinnings are %.2f.\n",(bet[3]*37));
  999.          totalwin = (totalwin + bet[3]*37);
  1000.          break;
  1001.        default :
  1002.          printf("Error number entered is out of range on board four\n" );
  1003.          break;
  1004.      }
  1005.      }
  1006.      else
  1007.      {
  1008.       if(result4>37)
  1009.      {
  1010.      printf("Error number entered out of range on board four");
  1011.      }
  1012.      else
  1013.      printf("You lost your forth bet.\nLossing %.2f.\n", bet[3]);
  1014.      }
  1015.      }
  1016.      printf("Total winnings are %.2f", totalwin);                                            /* total winnings displayed */
  1017.      }