<mosaic.cnfolio.com>
PROGRAM
1. /* PSEUDO CODE
2. START:
3.
4. Set Number of Bets To Zero
5. Set Number of payout to Zero
6. Set Number Of Profit and Loss To Zero
7. Set Number of TotalProfit To Zero
8. Set Number of Totalloss To Zero
9.
10. Get the Bet Number
11. Get The Bet Money
12.
13. Bet number is between ZERO and 36
14. Bet value's are positive numbers
15.
16. If bet equals to zero
17. THEN
18.    Display Error Statement
19. ELSE
20.    Spin the wheel using american wheel table with 00's
21.    Display Game Number
22.    Display Winning Number
23.    Display Bet Won
24.    Display Bet Lost
25.    Display Payout
26.    Display Bet Profit
27.    Display Bet Loss
28.    Display Total Profit
29.    Display Total Loss
30.
31. END
32. */
33. #include <stdio.h>
34. #include <stdlib.h>
35. #include<string.h>
36. int main(void)
37. {
38.
39. int cashwon1, cashwon2, cashwon3, cashwon4; // cashwon calculation values declaration //
40. int cashloss1, cashloss2, cashloss3, cashloss4; // cash loss ( money loss ) values declarations //
41. int Totalprofit, Totalloss; // Total profit of all 4 cash won and all 4 cash loss calculations value declaration //
42.
43. printf("Enter Bet One Number and Bet One Money \n"); // display the message to enter bet number 1 value and money //
44. char b1n[2]; // string input bet 1 number //
45. int b1m =0; // integer bet 1 money equals zero //
46. scanf("%s %d",&b1n,&b1m); // read the input for bet 1 number and bet 1 money //
47. printf("Bet One Number:%s\nBet One Cash:%d\n\n",b1n,b1m); // display bet 1 number and money //
48.
49. if((b1n < 0) || (b1m <= 0)) { // error statement check for bet 1 number and money //
50.    printf("Error Enter Correct Bet One Number and Money"); // display error message //
51.    return 0;
52. }
53.
54. printf("Enter Bet Two Number and Bet Two Money \n"); // display the message to enter bet number 2 value and money //
55. char b2n[2]; // string input bet 2 number //
56. int b2m =0; // integer bet 2 money equals zero //
57. scanf("%s %d",&b2n,&b2m); // read the input for bet 2 number and bet 2 money //
58. printf("Bet Two Number:%s\nBet Two Cash:%d\n\n",b2n,b2m); // display bet 2 number and money //
59.
60. if((b2n < 0) || (b2m <= 0)){ // error statement check for bet 2 number and money //
61.    printf("Error Enter Correct Bet Two Number and Money"); // display error message //
62.    return 0;
63. }
64.
65. printf("Enter Bet Three Number and Bet Three Money \n"); // display the message to enter bet number 3 value and money //
66. char b3n[2]; // string input bet 3 number //
67. int b3m =0; // integer bet 3 money equals zero //
68. scanf("%s %d",&b3n,&b3m); // read the input for bet 3 number and bet 3 money //
69. printf("Bet Three Number:%s\nBet Three Cash:%d\n\n",b3n,b3m); // display bet 3 number and money //
70.
71. if((b3n < 0) || (b3m <= 0)){ // error statement check for bet 3 number and money //
72.    printf("Error Enter Correct Bet Three Number and Money"); // display error message //
73.    return 0;
74. }
75.
76. printf("Enter Bet Four Number and Bet Four Money \n"); // display the message to enter bet number 4 value and money //
77. char b4n[2]; // string input bet 4 number //
78. int b4m = 0; // integer bet 4 money equals zero //
79. scanf("%s %d",&b4n,&b4m); // read the input for bet 4 number and bet 4 money //
80. printf("Bet Fourth Number:%s\nBet Fourth Cash:%d\n\n",b4n,b4m); // display bet 4 number and money //
81.
82. if((b4n < 0) || (b4m <= 0)){ // error statement check for bet 4 number and money //
83.    printf("Error Enter Correct Bet Four Number and Money"); // display error message //
84.    return 0;
85. }
86.
87. // Char String Array For String Values (Example: 00) //
88. const char * roulette[] = {"0","00","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36"};
89. int i; // integer i declaration for the For Loop //
90.
91. srand((unsigned) time(NULL)); //rand should only be called once //
92. for(i=0;i<1;i++){ // For Loop Condition that indicates that the loop runs only 1 time //
93. int idx = rand() % 38; // returns a pseudo random number between 0 - 38 //
94. char * value = roulette[idx]; // calls the number from the character array //
95. printf("Game# %d, Won Number: %s\n\n",i,value); // Display the game number and the won number //
96.
97. if(strcmp(b1n,value)==0){ // string compare between b1n and rand number, if bet one numbers equals to rand number //
98.     printf("Bet 1 Has Won\n\n"); // display the bet 1 has won message //
99.     cashwon1 = (b1m * 35); // payout value calculated as bet one money multiplied by 35 //
100.     printf("Cash Won: %d\n\n",cashwon1); // display the payout value //
101. }
102. else if(strcmp(b1n,value)!=0);{ // string compare between b1n and rand number, if bet one num not equals to rand number //
103.     printf("Bet 1 Has Lost \n\n"); // display the bet 1 has lost message //
104.     cashloss1 = (-1 * b1m); // payout loss calculated as bet one money multiplied by negative 1 //
105.     printf("Cash Loss1: %d\n\n",cashloss1); // Display the payout loss value //
106. }
107. if(strcmp(b2n,value)==0){ // string compare between b2n and rand number, if bet two numbers equals to rand number //
108.     printf("Bet 2 Has Won\n\n"); // display the bet 2 has won message //
109.     cashwon2 = (b2m * 35); // payout value calculated as bet two money multiplied by 35 //
110.     printf("Cash Won: %d\n\n",cashwon2); // display the payout value //
111. }
112. else if(strcmp(b2n,value)!=0);{ // string compare between b2n and rand number, if bet two num not equals to rand number //
113.     printf("Bet 2 Has Lost\n\n"); // display the bet 2 has lost message //
114.     cashloss2 = (-1 * b2m); // payout loss calculated as bet two money multiplied by negative 1 //
115.     printf("Cash Loss2: %d\n\n",cashloss2); // Display the payout loss value //
116. }
117. if(strcmp(b3n,value)==0){ // string compare between b3n and rand number, if bet three numbers equals to rand number //
118.     printf("Bet 3 Has Won\n\n"); // display the bet 3 has won message //
119.     cashwon3 = (b3m * 35); // payout value calculated as bet three money multiplied by 35 //
120.     printf("Cash Won: %d\n\n",cashwon3); // display the payout value //
121. }
122. else if(strcmp(b3n,value)!=0);{ // string compare between b3n and rand number, if bet three num not equals to rand number //
123.     cashloss3 = (-1 * b3m); // display the bet 3 has lost message //
124.     printf("Bet 3 Has Lost\n\n"); // payout loss calculated as bet three money multiplied by negative 1 //
125.     printf("Cash Loss3: %d\n\n",cashloss3); // Display the payout loss value //
126. }
127. if(strcmp(b4n,value)==0){ // string compare between b4n and rand number, if bet four numbers equals to rand number //
128.     printf("Bet 4 Has Won\n\n"); // display the bet 4 has won message //
129.     cashwon4 = (b4m * 35); // payout value calculated as bet four money multiplied by 35 //
130.     printf("Cash Won: %d\n\n",cashwon4); // display the payout value //
131. }
132. else if(strcmp(b4n,value)!=0);{ // string compare between b3n and rand number, if bet three num not equals to rand number //
133.     printf("Bet 4 Has Lost \n\n"); // display the bet 4 has lost message //
134.     cashloss4 =(-1 * b4m); // payout loss calculated as bet four money multiplied by negative 1 //
135.     printf("Cash Loss4: %d\n\n",cashloss4); // Display the payout loss value //
136. }
137.
138. Totalprofit = ((b1m * 35) + (b2m * 35) + (b3m * 35) + (b4m * 35)); // total profit calculation for all 4 amount bet //
139. printf("Total Profit: %d\n\n",Totalprofit); // display the total profit //
140.
141. Totalloss = (cashloss1 + cashloss2 + cashloss3 + cashloss4); // total loss calculation for all 4 bet //
142. printf("Total Loss: %d\n",Totalloss); // display the total loss //
143.
144. }
145. }