<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. Pseudo code
  3.  
  4.  
  5.  
  6. Start
  7. scan all the bets and the money bet
  8.  
  9. IF The bet entered is greater than thirty-seven or less then zero
  10. THEN
  11.        Display    Error message
  12.        Else
  13.        Display    No more bet
  14. END IF
  15.  
  16. Initialize
  17.  
  18.         Random number generator
  19.         Display   winning number
  20.        
  21. END SRAND
  22.  
  23.  
  24.  
  25. IF Bet one is equal to winning number
  26.  
  27. THEN
  28.  
  29.         Display money won is equal to money bet plus money bet times thirty-five
  30.         Display win amount and loss amount
  31.  
  32. ELSE
  33.  
  34.         Display bet one has lost
  35.         Display money lost is equal to money bet times negative one
  36.         Display win_loss amount
  37.  
  38. END IF
  39.  
  40.  
  41. IF Bet two is equal to winning number
  42.  
  43. THEN
  44.  
  45.         Display money won is equal to money bet plus money bet times thirty-five
  46.         Display win amount and loss amount
  47.  
  48. ELSE
  49.  
  50.         Display bet two has lost
  51.         Display money lost is equal to money bet times negative one
  52.         Display win_loss amount
  53.  
  54. END IF
  55.  
  56.  
  57. IF Bet three is equal to winning number
  58.  
  59. THEN
  60.  
  61.         Display money won is equal to money bet plus money bet times thirty-five
  62.         Display win amount and loss amount
  63.  
  64. ELSE
  65.  
  66.         Display bet three has lost
  67.         Display money lost is equal to money bet times negative one
  68.         Display win_loss amount
  69.  
  70. END IF
  71.  
  72.  
  73.  
  74. IF Bet four is equal to winning number
  75.  
  76. THEN
  77.  
  78.         Display money won is equal to money bet plus money bet times thirty-five
  79.         Display win amount and loss amount
  80.  
  81. ELSE
  82.  
  83.         Display bet four has lost
  84.         Display money lost is equal to money bet times negative one
  85.         Display win_loss amount
  86.  
  87. END IF
  88.  
  89.  
  90.         Display total profit and loss
  91.  
  92.  
  93.    END
  94.          END
  95.                 END
  96.  
  97. */
  98.  
  99.  
  100. #include <stdio.h>
  101. #include<stdlib.h>
  102. #include<time.h>
  103. #include<string.h>
  104.  
  105. int main(void)
  106. {
  107. int moneywon1 ;
  108. int moneywon2 ;
  109. int moneywon3 ;
  110. int moneywon4 ;
  111. int bet1=37;
  112. int moneybet1;
  113. int bet2=37;
  114. int moneybet2;
  115. int bet3=37;
  116. int moneybet3;
  117. int bet4=37;
  118. int moneybet4;
  119. int win_loss1;
  120. int win_loss2;
  121. int win_loss3;
  122. int win_loss4;
  123. int spin;
  124. char zerozero = "00" ;
  125. char bett1[2];
  126. char bett2[2];
  127. char bett3[2];
  128. char bett4[2];
  129.  
  130. int validate=0;
  131.  
  132.  
  133.  
  134. scanf("%d %d %d %d %d %d %d %d" , &bet1 , &moneybet1, &bet2, &moneybet2, &bet3 , &moneybet3, &bet4 , &moneybet4);
  135. printf("place your bets please\n"); /* here player inputs 8 numbers */
  136. if (bet1 >37   || bet2 >37 ||  bet3  >37    ||     bet4   >37  ||   bet1 <= bet1*-1  || bet2 <= bet2*-1 ||  bet3  <= bet3*-1    ||     bet4   <= bet4*-1 )
  137.  
  138.  
  139.  
  140. validate=1; /* if validate is 1 the proagram will display error and ask player to input correct bets */
  141.  
  142.  
  143.  
  144. printf("No more bets please\n");
  145.  
  146.  
  147.  
  148.  
  149. if (validate==0) /* if validate i equal to 0 then the proagram will compile the conditions */
  150. {
  151.  
  152.  
  153. srand (time(NULL)); /* random number generator between 00 to 36 and only one number displayed due to the function time*/
  154. spin = ( rand()%38);
  155.  
  156.  
  157.  
  158. if (spin==37) /* spin is the winning number*/
  159. printf(" %d \n" , spin );
  160. printf ("winning number %d\n" , spin) ; /* displays the winning number*/
  161.  
  162. if  (bet1==spin) /* comparing winningnumber to bet 1*/
  163. {
  164. moneywon1 = moneybet1 + (moneybet1*35) ; /* calculations to money won */
  165. printf("bet 1 has won %d\n" , moneywon1) ; /* prints bet 1 has won thats if it did win */
  166. win_loss1=moneywon1-moneybet1 ; /* calculations to win_loss*/
  167. printf("money won is equal to %d\n" , win_loss1 ); /* prints money won amount*/
  168.  
  169. }
  170.  
  171. else
  172. {
  173. printf("bet 1 has lost \n") ; /* prints bet 1 lost thats if it did loose */
  174. moneywon1=0 ;
  175. win_loss1=moneywon1-moneybet1 ;/* calculations to win_loss*/
  176.  
  177. printf("money lost is %d\n" , moneybet1*-1) ; /* prints money loss amount*/
  178. }
  179.  
  180. if  (bet2==spin)
  181. {
  182. moneywon2 = moneybet2 + (moneybet2*35) ;
  183. printf("bet 2 has won %d\n" , moneywon2) ;
  184. win_loss2=moneywon2-moneybet2 ;
  185. printf("money won is equal to %d\n" , win_loss2 );
  186.  
  187. }
  188.  
  189. else
  190. {
  191. printf("bet 2 has lost \n") ;
  192. moneywon2=0 ;
  193. win_loss2=moneywon2-moneybet2 ;
  194.  
  195. printf("money lost is %d\n" , moneybet2*-1) ;
  196. }
  197.  
  198. if  (bet3==spin)
  199. {
  200. moneywon3 = moneybet3 + (moneybet3*35) ;
  201. printf("bet 3 has won %d\n" , moneywon3) ;
  202. win_loss3=moneywon3-moneybet3 ;
  203. printf("money won is equal to %d\n" , win_loss3 );
  204.  
  205. }
  206.  
  207. else
  208. {
  209. printf("bet 3 has lost \n") ;
  210. moneywon3=0 ;
  211. win_loss3=moneywon3-moneybet3 ;
  212.  
  213. printf("money lost is %d\n" , moneybet3*-1) ;
  214. }
  215.  
  216. if  (bet4==spin)
  217. {
  218. moneywon4 = moneybet4+ (moneybet4*35) ;
  219. printf("bet 4 has won %d\n" , moneywon4) ;
  220. win_loss4=moneywon4-moneybet4 ;
  221. printf("money won is equal to %d\n" , win_loss4 );
  222.  
  223. }
  224.  
  225. else
  226. {
  227. printf("bet 4 has lost \n") ;
  228. moneywon4=0 ;
  229. win_loss4=moneywon4-moneybet4 ;
  230.  
  231. printf("money lost is %d\n" , moneybet4*-1) ;
  232. }
  233.  
  234. {printf("Total profitloss is %d\n" , win_loss1+win_loss2+win_loss3+win_loss4); /* prints the total profit and loss */
  235. }
  236. }
  237. else
  238. {printf("please ensure you input the correct bets \n"); /* error message if the inputs are incorrect  */
  239. }
  240.  
  241.  
  242. }