<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2.     START
  3.        SET number of bets to zero
  4.        WHILE number of bets is less than four
  5.          GET bet number and bet value
  6.          IF bet Value is less than 1
  7.             THEN
  8.                DISPLAY You have not bet enough money on a bet
  9.                END
  10.             ELSE
  11.                IF bet number is greater than 36 and lower than 0 or not 00
  12.                   THEN
  13.                      DISPLAY You have entered an invalid bet number
  14.                      END
  15.                END IF
  16.          END IF
  17.        END WHILE
  18.        SPIN wheel to get a number between 0 and 36 and the number 00
  19.        DISPLAY winning number
  20.        SET counter to 0
  21.        WHILE Counter is less than four     
  22.             Add one to Counter
  23.              DISPLAY bet number
  24.              IF landing number is equal to bet number THEN
  25.                  ADD bet value to Wallet Value
  26.                  Add bet counter times 35 to Wallet value
  27.                   DISPLAY bet value time 35
  28.             END IF
  29.              Display Winnings so far
  30.              Display the amount of money you have bet so far
  31.              Display Wallet value
  32.        END WHILE
  33.        Display Winning
  34.    END
  35. */
  36. #include <stdio.h>
  37. #include <stdlib.h>
  38. #include <string.h>
  39. #include <time.h>
  40. int main(void){
  41.     int landingnumber = 38;
  42.     char landingnumberchar[2] = ("\0");
  43.    char betnumberchar[] = {"\0"};
  44.    int betnumber[4];
  45.    int betmoney[4] = {0};
  46.    int winbet;
  47.    int moneywon = 0;
  48.    int moneyloss = 0;
  49.    int counter, counter1;
  50.    
  51.    counter = 0;
  52.    while (counter < 4)
  53.       {
  54.          
  55.          scanf("%s %d",betnumberchar, &betmoney[counter]);
  56.          for (counter1 = 0; counter1 <= strlen(betnumberchar); counter1++){
  57.          if (isalpha(betnumberchar[counter])){
  58.             printf("You have put a letter in to bet on");
  59.             exit(0);
  60.           }
  61.          }
  62.          
  63.          if (strcmp(betnumberchar,"00")==0)
  64.             betnumber[counter] = 37;
  65.            
  66.          else
  67.             betnumber[counter] = atoi(betnumberchar);
  68.          
  69.          if (betnumber[counter] > 37){
  70.             printf("You have entered a too high of a number to bet on");
  71.             exit(0);
  72.             }
  73.          if (betmoney[counter]<1){
  74.             printf("You cannot enter no ammount for a bet");
  75.             exit(0);
  76.             }
  77.          
  78.          if (betnumberchar == "" ){
  79.             printf("You have not entered enough numbers");
  80.             exit(0);
  81.          }
  82.          if (betnumber[counter] < 0){
  83.             printf("A too low of a number to bet on");
  84.             exit(0);
  85.             }
  86.          
  87.          counter++;
  88.          
  89.       }
  90.    counter = 0;   
  91.    for ( counter = 0; counter <= 4; counter++){
  92.       for (counter1 = 0; counter1 <= 4; counter1++){
  93.          if (counter != counter1){
  94.             if (betnumber[counter] == betnumber[counter1]){
  95.                printf("You are missing an input");
  96.                exit(1);
  97.             }
  98.          }
  99.       }
  100.    }
  101.    
  102.    counter = 0;
  103.    srand( time(0) );
  104.    while (landingnumber > 37)
  105.       landingnumber = rand();
  106.    counter = 0;
  107.    winbet = 0;
  108.    
  109.     if (landingnumber == 37)
  110.       sprintf(landingnumberchar,"%s","00");
  111.      
  112.    else if ((landingnumber >= 0) && (landingnumber <=36))
  113.       sprintf(landingnumberchar,"%d",landingnumber);
  114.    
  115.    
  116.      
  117.    
  118.    printf("The number the ball landed on was %s\n", landingnumberchar);
  119.    while (counter<4)
  120.    { 
  121.       printf("-------------------------------------------------------------------\n");
  122.       printf("Bet %d\n", counter + 1);
  123.       if (betnumber[counter] == 37)
  124.          sprintf(betnumberchar,"%s","00");
  125.      
  126.       else if ((betnumber[counter] >= 0) && (betnumber[counter] <=36))
  127.          sprintf(betnumberchar,"%d",betnumber[counter]);
  128.          
  129.       if (betnumber[counter] == landingnumber){
  130.          moneywon +=(betmoney[counter] *35);
  131.          winbet +=(betmoney[counter] *35);
  132.          moneyloss = moneyloss + betmoney[counter];
  133.          winbet = winbet + betmoney[counter];
  134.        printf("You just won %d.00 betting on %s\n", betmoney[counter]*35, betnumberchar);}
  135.       else{
  136.          winbet = winbet - betmoney[counter];
  137.          moneyloss += betmoney[counter];
  138.          printf("You just lost %d.00 betting on %s\n", betmoney[counter], betnumberchar);}
  139.      
  140.       printf("Total money won so far: %d\n", moneywon);
  141.       printf("Total money lost so far: -%d\n", moneyloss);
  142.       printf("Subtotal = %d\n",winbet);   
  143.       counter++;
  144.    }
  145.    printf("-------------------------------------------------------------------\n");
  146.    if (winbet > 0)
  147.       printf("You have just made a profit of %d.00", winbet);
  148.    else if (winbet < 0)
  149.       printf("You have just made a loss of %d.00", winbet);
  150.    
  151. }