<mosaic.cnfolio.com>
PROGRAM
  1. /* Psudocode
  2.  
  3. START
  4.    BetNumber = -1
  5.    BetMoney = -1
  6.    WinningNumber = 0
  7.    WinningMoney = 0
  8.    TotalWinnings
  9.    X = 0
  10.    FOR X = 1 to 4
  11.       INPUT BetNumber and BetMoney
  12.      
  13.       IF Betnumber = -1
  14.          PRINT No number inputted
  15.       END IF
  16.      
  17.      
  18.       IF BetMoney = -1
  19.          PRINT No Money Inputted
  20.       END IF
  21.      
  22.      
  23.       IF Betnumber is inputted but isn't 00 or anything between 0 to 35 THEN
  24.          PRINT Not a vaild bet number
  25.       END IF
  26.      
  27.          
  28.       WinningNumber randomly picked from 0 to 35 or pick 00
  29.      
  30.       PRINT Betnumber Betmoney and WinningNumber
  31.      
  32.       IF BetNumber and WinningNumber are the same THEN
  33.          WinningMoney = BetMoney * 35
  34.          TotalWinnings = TotalWinnings + WinningMoney
  35.          PRINT BetNumber BetMoney WinningNumber WinningMoney
  36.          PRINT Win!
  37.       END IF   
  38.      
  39.       IF BetNumber and WinningNumber are NOT the same THEN
  40.          LosingMoney = LosingMoney - BetMoney
  41.          TotalWinnings = TotalWinnings - LosingMoney
  42.          PRINT BetNumber BetMoney WinningNumber LosingMoney
  43.          PRINT Lose!
  44.       END IF
  45.      
  46.    END FOR
  47.    
  48.   PRINT Total Net Profit: TotalWinnings
  49.  
  50. END
  51. */
  52. #include <stdio.h>
  53. #include <time.h>
  54. #include <stdlib.h>
  55.  
  56. int main(void)
  57. {
  58. int no;
  59. int x;
  60. int betno = -1;
  61. float betmoney = -1;
  62. int WMoney;
  63. float TMoney = 0;
  64. srand( time(0));
  65.  
  66. /* Scans 4 times */
  67. printf("Your current bets:\n\n");
  68. for (x =  0; x < 4; x++)
  69.    {
  70.    scanf("%d %f", &betno, &betmoney);
  71.    
  72.    /* Using rand() defining it and below that is using placing the range of it. */
  73.    no = rand();
  74.    no = no % 38;
  75.    
  76.    /*Checks if anything is inputted, nothing inputted, will stop the program and come with an error*/
  77.    if(betno == -1 && betmoney == -1)
  78.       {
  79.       printf("Must have a total of 4 bets made.\n");
  80.       return(0);
  81.       }
  82.    
  83.    /* Checks if there is actually money betted, placed these on top so it runs it first to check*/
  84.    if (betno >= 37|| betno < 0)
  85.       {
  86.       printf("Enter a vaild bet number.");
  87.       return(0);
  88.       }
  89.    if (betmoney <= 0)
  90.       {
  91.       printf("You must bet something.");
  92.       return(0);
  93.       }
  94.  
  95.    /* Prints 00 from the integer as a string because it will come as 0 if you input 00*/
  96.    if (betno == 00)
  97.       {
  98.       printf("Bet number: 00\nBet money: %.2f", betmoney);
  99.       printf("\n");
  100.       }
  101.    
  102.    if (betno != 00)
  103.       {
  104.       printf("Bet number: %d\nBet money: %.2f", betno, betmoney);
  105.     printf("\n");
  106.       }
  107.      
  108.    /* Printing the random number generated */
  109.    if (no <= 37)
  110.       {
  111.       printf("Winning Number: %d\n", no);
  112.       }
  113.    
  114.    if (no == 37)
  115.       {
  116.       printf("Winning Number: 0\n");
  117.       }
  118.      
  119.    if (no == 38)
  120.       {
  121.       printf("Winning Number: 00\n");
  122.       }
  123.    
  124.    /* if they get a bet number win pay out is *35 of their bet, set the betno and betmoney back to -1 so the loop checks it
  125.    makes sure there is actually something inputted in the next scan*/
  126.    if (betno == no && no <=37)
  127.       {
  128.       WMoney = betmoney * 35;
  129.       printf("Money Won: %d\n", WMoney);
  130.       TMoney = TMoney + WMoney;
  131.       printf("Payout Value: %.2f x35\n",betmoney);
  132.       printf("Current Earnings: %.2f\n", TMoney);
  133.       printf("Win!\n\n\n");
  134.       betno = -1;
  135.       betmoney = -1;
  136.       }
  137.    
  138.    if (betno == 0 && no == 37)
  139.       {
  140.       WMoney = betmoney * 35;
  141.       printf("Money Won: %d\n", WMoney);
  142.       TMoney = TMoney + WMoney;
  143.       printf("Payout Value: %.2f x35\n",betmoney);
  144.       printf("Current Earnings: %.2f\n\n", TMoney);
  145.       printf("Win!\n\n\n");
  146.       betno = -1;
  147.       betmoney = -1;
  148.       }
  149.    
  150.    if (betno == 00 && no == 38)
  151.       {
  152.       WMoney = betmoney * 35;
  153.       printf("Money Won: %d\n", WMoney);
  154.       TMoney = TMoney + WMoney;
  155.       printf("Payout Value: %.2f x35\n",betmoney);
  156.       printf("Won: %.2f\n", TMoney);
  157.       printf("Win!\n\n\n");
  158.       betno = -1;
  159.       betmoney = -1;
  160.       }
  161.    
  162.    if (betno != no)
  163.       {
  164.       TMoney = TMoney - betmoney;
  165.       printf("Payout Value: %.2f x35\n",betmoney);
  166.       printf("Lost: %.2f\n", betmoney);
  167.       printf("Lose!\n\n\n");
  168.       betno = -1;
  169.       betmoney = -1;
  170.       }
  171.      
  172.    /* Total profit at the end of the 4 bets*/
  173.    if(x == 3)
  174.       {
  175.       printf("Total Net Profit: %.2f", TMoney);
  176.       }
  177.    }
  178. }