<mosaic.cnfolio.com>
PROGRAM
1. /* START
2.      Get bet
3.      Spin wheel using american styled table
4.      IF a bet amount or bet number < 0 or bet number > 37
5.        THEN
6.          Display error message
7.        ELSE
8.          Display bet number
9.          Display bet amount
10.          Display winning number
11.          If bet number is equal to winning number
12.            THEN
13.              Display bet amount multiplied by 35 as payout value
14.            ELSE
15.              Display 0 as payout value
16.           END IF
17.         END IF
18.     Repeat the bet with random numbers to simulate 4 different bets
19.     IF the sum of the bet values < the sum of payout values
20.       THEN
21.         Display that the player wins and the total profit
22.       ELSE
23.         Display that the player loses and the total loss
24.      END IF
25.   END */
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36. #include <stdio.h>
37. #include <stdlib.h>
38. #include <time.h>
39.
40. int main( void )
41. {
42.   int number1, money1, number2, money2, number3, money3, number4, money4;
43.   int b1, b2, b3, b4, b5, m5, number;
44.   37==00;
45.   scanf( "%d %d %d %d %d %d %d %d", &number1, &money1, &number2, &money2, &number3, &money3, &number4, &money4 );
46.   srand( time( 0 ) );
47.   number = rand() % 38;
48.    if ( ( money1<=0 || money2<=0 || money3<=0 || money4<=0 ) || ( number1>37 || number2>37 || number3>37 || number4>37 ) || ( number1<0 || number2<0 || number3<0 || number4<0 ) )
49.     {
50.        printf("ERROR!!! THE INPUT VALUES ARE INCORRECT OR MISSING!");
51.     }
52.    else
53.     {
54.    if ( number == number1 )
55.     {
56.        b1 = money1*35;
57.        printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d. THE PAYOUT VALUE IS %d. THE PLAYER WINS!", number1, money1, number, b1);
58.     }
59.
60.    else
61.
62.     {
63.       b1 = 0;
64.       printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d.THE PAYOUT VALUE IS %d. THE PLAYER LOSES!", number1, money1, number, b1);
65.     }
66.     number = rand() % 38;
67.
68.   if ( number == number2 )
69.     {
70.        b2 = money2*35;
71.        printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d. THE PAYOUT VALUE IS %d. THE PLAYER WINS!", number2, money2, number, b2);
72.     }
73.
74.    else
75.
76.     {
77.       b2 = 0;
78.       printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d.THE PAYOUT VALUE IS %d. THE PLAYER LOSES!", number2, money2, number, b2);
79.     }
80.     number = rand() % 38;
81.   if ( number == number3 )
82.     {
83.        b3 = money3*35;
84.        printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d. THE PAYOUT VALUE IS %d. THE PLAYER WINS!", number3, money3, number, b3);
85.     }
86.
87.    else
88.
89.     {
90.       b3 = 0;
91.       printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d.THE PAYOUT VALUE IS %d. THE PLAYER LOSES!", number3, money3, number, b3);
92.     }
93.     number = rand() % 38;
94.   if ( number == number4 )
95.     {
96.        b4 = money4*35;
97.        printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d. THE PAYOUT VALUE IS %d. THE PLAYER WINS!", number4, money4, number, b4);
98.     }
99.
100.    else
101.
102.     {
103.       b4 = 0;
104.       printf( "THE BET NUMBER IS %d. THE BET AMOUNT IS %d. THE WINNING NUMBER IS %d.THE PAYOUT VALUE IS %d. THE PLAYER LOSES!", number4, money4, number, b4);
105.     }
106.   if ( money1 + money2 + money3 + money4 < b1 + b2 + b3 + b4 )
107.     {
108.       b5 = b1 + b2 + b3 + b4;
109.       printf( "THE PLAYER WON!!! TOTAL PROFIT %d", b5 );
110.     }
111.   else
112.     {
113.       m5 = money1 + money2 + money3 + money4;
114.       printf( "THE PLAYER LOST! TOTAL LOSS %d", m5 );
115.     }
116.     }
117. }