<mosaic.cnfolio.com>
PROGRAM
1. /*                               PSEUDOCODE
2. START
3.       DISPLAY  "*************Welcome to the Roulette*************"
4.       DISPLAY  "Entering to the Roulette,You have £100"
5.       Spin the wheel using american (00) style             \*Assume, 37 as 00 *\
6.
7.       FOR i=0 to STEP 3 DO
8.
9.                 GET SingleBetNumber and Amount Bet
10.
11.            IF bet amount is less than or equal to bank amount, Then
12.                     IF SingleBetNumber is greater than 0 OR less than 37 AND Bet amount is greater than 0, Then
13.
14.                                 IF SingleBetNumber is equal to winningNumber, Then
15.                                    DISPLAY  Bet number and Bet amount
16.                                    DISPLAY  Winning Number
17.                                    DISPAY payout value as 35 times of Bet amount
18.                                    SET bank equal to ADD bank to payout value
19.                                    ADD payout value and bet amount to DISPLAY Net profit for single bet
20.                                 ELSE
21.                                    DISPLAY  Bet number and Bet amount
22.                                    DISPLAY  Winning Number
23.                                    DISPLAY payout value as 0
24.                                    DISPLAY  NetLoss for Single Bets as bet amount
25.                                    SET Bank equal to SUBSTRACT bet amount from bank
26.                                 END IF
27.                      ELSE
28.                              print " ERROR => Sorry, You have entered incorrect Bet number or Bet amount "
29.                      ENDIF
30.              ELSE
31.                     print " Sorry, You dont have enough balance "
32.                     print " You have entered incorrect bet amount "
33.              END IF
34.
35.                    CALCULATE sum of bank amount for each bet
36.         END FOR
37.
38.      DISPLAY Total available Bank Amount for 4 bets
39. END
40. */
41.
42. /* Note :- Here, we are assuming 37 as 00. */
43.
44. #include <stdio.h>
45. #include <stdlib.h>
46.
47. int SingleBetNumber[4],AmountBet[4],bank=100,payout[4];      // Declaration For Integer
48. int WinningNum, NetLoss_4_Bets;            // Declaration For Integer
49.
50. int main ( void )
51. {
52.             printf("                         ****************Welcome to the Roulette****************");
53.             printf("\n\nEntering to the Roulette,You have £100\n");
54.             srand(time(NULL));                      // seed the random number generator from the system clock
55.       WinningNum = rand()%38;                  // Function to generate random number between range of 0 and 37//Take Input as Single bet number and AmountBet
56.
57.
58.
59.     for(int i=0; i < 4; ++i)        // loop to display number of four bets
60.       {
61.         printf("\n\n ******************************************************************");
62.          scanf("%d %d",&SingleBetNumber[i], &AmountBet[i]);
63.
64.          if(bank>=AmountBet[i])                                                // if bet amount is less than or equal to bank amount
65.            {
66.              if(SingleBetNumber[i]>=0 && SingleBetNumber[i]<=37 && AmountBet[i] > 0)               //Condition, if bet number is between 0 and 37 AND Amount bet is greater than zero
67.                   {
68.                             if(SingleBetNumber[i]==WinningNum)               //Compare, the values of singlebetnumber equal to winning number
69.                                 {
70.                                    printf("\n     You have bet £%d on the number %d", AmountBet[i], SingleBetNumber[i]);   //Display Bet Number and Amount Bet
71.                      printf("\n     Best of Luck . Here are the Results.");
72.                                      printf("\n     Congratulation, You Won ! The winning number was %d.",WinningNum); //Display Winning number
73.                                      payout[i] = (AmountBet[i]*35);                    // To Calculate the PayOut Value
74.                                      bank+=payout[i];            //Calculate, total money after betti
75.                                      printf("\n     Payout value : £%d ", payout[i]); // Display Payout Value
76.                                      printf("\n     You now have : £%d ",bank);
77.                                      printf("\n     Net Profit For Single Bet : £%d",AmountBet[i]+payout[i]);   // Display Net profit for single bet
78.                                 }
79.                             else
80.                                 {
81.                                    printf("\n     You have bet £%d on the number %d", AmountBet[i], SingleBetNumber[i]);   //Display Bet Number and Amount Bet
82.                      printf("\n     Best of Luck . Here are the Results.");
83.                                      printf("\n     Bad Luck, You Loss! The winning number was %d.",WinningNum);
84.                                      payout[i] =0;             // Display payout as 0
85.                                      bank-= AmountBet[i];
86.                                      printf("\n     Payout Value : £%d",payout[i])// Display Payout value
87.                                      printf("\n     You now have : £%d ",bank);
88.                                      printf("\n     Net Loss For Single Bet : £%d",AmountBet[i]);   // Display Net loss for single bet
89.                                 }
90.                     }
91.                 else
92.                     {
93.                         printf("\n     ERROR => Sorry, You have entered incorrect Bet number or Bet amount.");    // Print Winning Number
94.
95.                     }
96.             }
97.          else
98.             {
99.                   printf("\n     Sorry, You dont have enough balance.");
100.                   printf("\n     You have entered incorrect bet amount.");
101.             }
102.
103.              bank=0+bank;            // sum of total money for each bet
104.          }
105.
106.      printf("\n\n\n Total money available in bank : £%d",bank);                     // Display total money for four bets
107.
108.
109. }