<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2.  
  3.    Read 8 Numbers - One Pair/One Bet & Money Ammount
  4.    One Pair run 4 times to shows 4 bets
  5.    rand() function used - simulate winning roulette numbers
  6.    US style layout Roulette (0-37)
  7.  
  8.    e.g.
  9.    Bet = bet number      (23)
  10.        = bet ammount   (50)
  11.        = winning number  (23) (uses rand() funtion)
  12.        ...
  13. */
  14. /*
  15. PSEUDO CODE
  16. START
  17.  
  18. Set initial amount to 0
  19. Set number of bets to 0
  20. Set counter to 0
  21. Generate Roulette game
  22. Obtain 8 input numbers
  23. Simulate 4 consecutive bets
  24. Generate random Roulette winning numbers
  25.  
  26.    WHILE first bet is recorded
  27.       increase number of bets by 1
  28.       Add amount from first bet to initial amount
  29.       IF first bet is won
  30.          keep amount from first bet
  31.          make Second bet
  32.          increase number of bets by 1
  33.       ELSE
  34.          take ammount from first bet away from initial amount
  35.          make second bet
  36.          increase nummber of bets by 1
  37.       END IF
  38.    print outstanding bets
  39.    print initial amount
  40.    print winning number
  41.    END WHILE
  42.    WHILE second bet is recorded
  43.       increase number of bets by 1
  44.       Add amount from second bet to initial amount
  45.       IF second bet is won         
  46.          keep amount from second bet
  47.          make third bet
  48.          increase number of bets by 1
  49.       ELSE
  50.          take ammount from second bet away from initial amount
  51.          make third bet
  52.          increase nummber of bets by 1
  53.       END IF
  54.    print outstanding bets
  55.    print initial amount
  56.    print winning number
  57.    END WHILE
  58.    WHILE third bet is recorded
  59.       increase number of bets by 1
  60.       Add amount from third bet to initial amount
  61.       IF first bet is won
  62.          keep amount from third bet
  63.          make Second bet
  64.          increase number of bets by 1
  65.       ELSE
  66.          take ammount from third bet away from initial amount
  67.          make third bet
  68.          increase nummber of bets by 1
  69.       END IF
  70.    print outstanding bets
  71.    print initial amount
  72.    print winning number
  73.    END WHILE
  74.    WHILE fourth bet is recorded
  75.       increase number of bets by 1
  76.       Add amount from fourth bet to initial amount
  77.       IF first bet is won
  78.          keep amount from fourth bet
  79.          make Second bet
  80.          increase number of bets by 1
  81.       ELSE
  82.          take ammount from fourth bet away from initial amount
  83.          make third bet
  84.          increase nummber of bets by 1
  85.       END IF
  86.    print outstanding bets
  87.    print initial amount
  88.    print winning number
  89.    END WHILE
  90. print error message of missing input numbers for bet number and ammount if neccesary.
  91. END
  92. */
  93.  
  94. #include <stdio.h>
  95. #include <stdlib.h>
  96. #include <time.h>
  97.  
  98.  
  99. int main()
  100.  
  101. {
  102.    int betnumber[4]={1,2,3,4}; /* The number of bets */
  103.    int i=0;
  104.    
  105.    for(i=0; i<4; i++)
  106.    {
  107.       
  108.    scanf("Bet number: %d\n", betnumber[0]);
  109.    printf("The Bet winning number is %d\n\r", rand()%37); /* roulette winning number */
  110.    
  111.    printf("Bet number: %d\n", betnumber[1]);
  112.    scanf("%d",&betnumber[2]);
  113.    
  114.    printf("Bet number: %d\n", betnumber[2]);
  115.    scanf("%d",&betnumber[3]);
  116.    
  117.    printf("Bet number: %d\n", betnumber[3]);
  118.    scanf("%d",&betnumber[4]);
  119.    }
  120. }