<mosaic.cnfolio.com>
PROGRAM
1. /*
3. Start the program
4. Set all the variables as integers and sum as float
5. Print “WELCOME TO LUKES ROULETTE TABLE! WELCOME TO LUKES ROULETTE TABLE!”
6. Scan for a total of 8 inputs
7.   IF chosen numbers are less than 38
8.      IF chosen numbers are greater than 0
9.         Check if inputs are integers
10.
11.            Generate random number 1
12.
13.            Generate random number 2
14.
15.            Generate random number 3
16.
17.            Generate random number 4
18.
19.
20.         Print “The first number was …”
21.         Print “Your bet for this round is …”
22.         Print “Your chosen number for this round is …”
23.         IF
24.            The first numbers match
25.            Times the first bet by 36
26.            Add the prize to the net sum
27.            Print “This rounds prize is…”
28.            Print “Your net sum is …”
29.         ELSE IF
30.            The numbers don’t match
31.            Net sum minus bet amount
32.            Print “Your profit/losses are £… this round”
33.
34.         Print “The second number was …”
35.         Print “Your bet for this round is …”
36.         Print “Your chosen number for this round is …”
37.         IF
38.            The second numbers match
39.            Times the second bet by 36
40.            Add the prize to the net sum
41.            Print “This rounds prize is…”
42.            Print “Your net sum is …”
43.         ELSE IF
44.            The numbers don’t match
45.            Net sum minus bet amount
46.            Print “Your profit/losses are £… this round”
47.
48.         Print “The third number was …”
49.         Print “Your bet for this round is …”
50.         Print “Your chosen number for this round is …”
51.         IF
52.            The third numbers match
53.            Times the third bet by 36
54.            Add the prize to the net sum
55.            Print “This rounds prize is…”
56.            Print “Your net sum is …”
57.         ELSE IF
58.            The numbers don’t match
59.            Net sum minus bet amount
60.            Print “Your profit/losses are £… this round”
61.
62.         Print “The forth number was …”
63.         Print “Your bet for this round is …”
64.         Print “Your chosen number for this round is …”
65.         IF
66.            The  forth numbers match
67.            Times the first bet by 36
68.            Add the prize to the net sum
69.            Print “This rounds prize is…”
70.            Print “Your net sum is …”
71.         ELSE IF
72.               The numbers don’t match
73.               Net sum minus bet amount
74.         Print “Your profit/losses are £… this round”
75.
76.         IF
77.               The net sum is positive
78.               Print “Congratualtions you won …”
79.         ELSE IF
80.               the net sum is negative
81.               Print “Unfortunatly you lost …”
82.      ELSE
83.         Print "Please enter 8 positive numbers only!"
84.    ELSE
85.       Print "Please enter positive numbers only"
86. ELSE
87.    Print " Please only enter numbers on the roulette table!"
88. */
89.
90.
91. #include <stdio.h>
92. #include <stdlib.h>
93. #include <time.h>
94.
95. int main(void)
96. {
97.    int number1 = 0, number2 = 0, number3 = 0, number4 = 0;
98.    int prize1 = 0, prize2 = 0, prize3 = 0, prize4 = 0;
99.    int bet1 = 0, bet2 = 0, bet3 = 0, bet4 = 0;
100.    int num1 = 0, num2 = 0, num3 = 0, num4 = 0;
101.    int num_of_matched_inputs = 0;
102.    float sum = 0;
103.    int net_sum1 = 0, net_sum2 = 0, net_sum3 = 0, net_sum4 =0;
104.
105.     printf(" WELCOME TO LUKES ROULETTE TABLE!\n\n");
106.
107.     srand(time(0));
108.
109.     num_of_matched_inputs = scanf("%d %d %d %d %d %d %d %d", &bet1, &num1, &bet2, &num2, &bet3, &num3, &bet4, &num4);
110.
111.    if (num_of_matched_inputs == 8)
112.     {
113.       if ( num1 <= 37 && num2 <= 37 && num3 <= 37 && num4 <=37)
114.       {
115.          if ( num1 >= 0 && num2 >=0 && num3 >=0 && num4 >=0 )
116.          {
117.             number1 = rand() % 37;
118.             number2 = rand() % 37;
119.             number3 = rand() % 37;
120.             number4 = rand() % 37;
121.
122.             printf(" The first number was %d! \n", number1);
123.             printf(" Your bet for this round is £%d \n", bet1);
124.             printf(" Your chosen number for this round is %d \n",  num1);
125.
126.             if (number1 ==  num1)
127.             {
128.                prize1 = bet1 * 36;
129.                net_sum1 = net_sum1 + prize1;
130.                printf(" This rounds prize is £%d \n", prize1);
131.                printf(" Your net sum is £%d \n", net_sum1);
132.             }
133.             else if (number1 !=  num1)
134.             {
135.                net_sum1 = net_sum1 - bet1;
136.                printf(" Your profit/losses are £%d this round \n", net_sum1);
137.             }
138.
139.             printf(" \n\n The second number was %d!\n", number2);
140.             printf(" Your bet for this round is £%d\n", bet2);
141.             printf(" Your chosen number for this round is %d \n",  num2);
142.             if (number2 ==  num2)
143.             {
144.                prize2 = bet2 * 36;
145.                net_sum1 = net_sum1 + prize2;
146.                printf(" This rounds prize is £%d \n", prize2);
147.                printf(" Your net sum is £%d \n", net_sum1);
148.             }
149.             else if (number2 !=  num2)
150.             {
151.                net_sum1 = net_sum1 - bet2;
152.                printf(" Your profit/losses are £%d this round \n", net_sum1);
153.             }
154.
155.             printf(" \n\n The third number was %d!\n", number3);
156.             printf(" Your bet for this round is £%d\n", bet3);
157.             printf(" Your chosen number for this round is %d\n",  num3);
158.             if (number3 ==  num3)
159.             {
160.                prize3 = bet3 * 36;
161.                net_sum1 = net_sum1 + prize3;
162.                printf(" This rounds prize is £%d \n", prize3);
163.                printf(" Your net sum is £%d \n", net_sum1);
164.             }
165.             else if (number3 !=  num3)
166.             {
167.                net_sum1 = net_sum1 - bet3;
168.                printf(" Your profit/losses are £%d this round\n", net_sum1);
169.             }
170.
171.             printf(" \n\n The fourth number was %d!\n", number4);
172.             printf(" Your bet for this round is £%d\n", bet4);
173.             printf(" Your chosen number for this round is %d\n",  num4);
174.             if (number4 ==  num4)
175.             {
176.                prize4 = bet4 * 36;
177.                net_sum1 = net_sum1 + prize4;
178.                printf(" This rounds prize is £%d \n", prize4);
179.                printf(" Your net sum is £%d \n", net_sum1);
180.             }
181.             else if (number4 !=  num4)
182.             {
183.                net_sum1 = net_sum1 - bet4;
184.                printf(" You profit/losses are £%d this round \n", net_sum1);
185.             }
186.             if (net_sum1 > 0)
187.             {
188.                printf(" \nCongratualtions you won £%d", net_sum1);
189.             }
190.             else if (net_sum1 < 0)
191.             {
192.                printf(" \n Unfortunatly you lost £%d", net_sum1);
193.             }
194.          }
195.          else
196.          {
197.             printf(" Please enter 8 positive numbers only");
198.          }
199.       }
200.       else
201.       {
202.          printf(" Please only enter numbers on the roulette table!\n");
203.       }
204.    }
205.    else
206.    {
207.       printf(" Please enter 8 positive numbers only");
208.    }
209. }