<mosaic.cnfolio.com>
PROGRAM
  1. /* Psuedo Code */
  2. /*
  3. START
  4.    
  5.    IF input it too high/low or not present
  6.       SET error to 1 to be read later
  7.    END IF
  8.    
  9.    IF error is 1
  10.       DISPLAY instructions to use code
  11.       DISPLAY error message
  12.    END IF
  13.    
  14.    MOVE random number between 0 and 36 to land1
  15.    MOVE random number between 0 and 36 to land2
  16.    MOVE random number between 0 and 36 to land3
  17.    MOVE random number between 0 and 36 to land4
  18.    
  19.    IF land1 is equal to 37
  20.       DISPLAY message stating that the ball landed on 00
  21.    ELSE
  22.       DISPLAY message showing the number that the ball landed on
  23.    END IF
  24.    
  25.    IF land1 is equal to num1
  26.       MULTIPLY bet1 by 35
  27.       DISPLAY the profit from the first bet
  28.    ELSE
  29.       DIVIDE bet1 by -1
  30.       DISPLAY the loss from the first bet
  31.    END IF
  32.      
  33.    IF land2 is equal to 37
  34.       DISPLAY message stating that the ball landed on 00
  35.    ELSE
  36.       DISPLAY message showing the number that the ball landed on
  37.    END IF
  38.    
  39.    IF land2 is equal to num2
  40.       MULTIPLY bet2 by 35
  41.       DISPLAY the profit from the second bet
  42.    ELSE
  43.       DIVIDE bet2 by -1
  44.       DISPLAY the loss from the second bet
  45.    END IF
  46.      
  47.    IF land3 is equal to 37
  48.       DISPLAY message stating that the ball landed on 00
  49.    ELSE
  50.       DISPLAY message showing the number that the ball landed on
  51.    END IF
  52.    
  53.    IF land3 is equal to num3
  54.       MULTIPLY bet3 by 35
  55.       DISPLAY the profit from the third bet
  56.    ELSE
  57.       DIVIDE bet3 by -1
  58.       DISPLAY the loss from the third bet
  59.    END IF
  60.      
  61.    IF land4 is equal to 37
  62.       DISPLAY message stating that the ball landed on 00
  63.    ELSE
  64.       DISPLAY message showing the number that the ball landed on
  65.    END IF
  66.    
  67.    IF land4 is equal to num4
  68.       MULTIPLY bet4 by 35
  69.       DISPLAY the profit from the fourth bet
  70.    ELSE
  71.       DIVIDE bet4 by -1
  72.       DISPLAY the loss from the fourth bet
  73.    END IF
  74.      
  75.    ADD the profits from the four bets
  76.    
  77.    IF the money made is greater than 0
  78.       DISPLAY the total profit made
  79.    ELSE
  80.       DISPLAY the total loss
  81.    END IF
  82.    
  83. END
  84. */
  85.  
  86. /* C Libraries */
  87.  
  88. #include <stdio.h>
  89. #include <string.h>
  90. #include <time.h>
  91.  
  92. /* Start of Code */
  93.  
  94. int main (void){   /* Starts the main code */
  95. int num1,bet1,prof1,num2,bet2,prof2,num3,bet3,prof3,num4,bet4,prof4;  /* Creates the titles to be used in the code */
  96. int error1,error2,error3,land1,land2,land3,land4,proftot;
  97. scanf( "%d %d %d %d %d %d %d %d", &num1, &bet1, &num2, &bet2, &num3, &bet3, &num4, &bet4);      /* Scans for inputs and relates them to specific titles */
  98.  
  99. /* Checking Syntax */
  100.  
  101. error1=0;      /* Set error values to 0 */
  102. error2=0;      /* Set error values to 0 */
  103. error3=0;      /* Set error values to 0 */
  104. if (num1>38)   {error1=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  105. if (num2>38)   {error1=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  106. if (num3>38)   {error1=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  107. if (num4>38)   {error1=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  108. if (num1<0)    {error1=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  109. if (num2<0)  {error1=1;}    /* scan inputs for errors, if any errors occur make the error code go to 1 */
  110. if (num3<0)  {error1=1;}    /* scan inputs for errors, if any errors occur make the error code go to 1 */
  111. if (num4<0)  {error1=1;}    /* scan inputs for errors, if any errors occur make the error code go to 1 */
  112. if (bet1<=0)   {error3=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  113. if (bet2<=0)   {error3=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  114. if (num3<=0)   {error3=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  115. if (bet4<=0)   {error3=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  116. if (bet1>32000){error2=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  117. if (bet2>32000){error2=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  118. if (num3>32000){error2=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  119. if (bet4>32000){error2=1;}  /* scan inputs for errors, if any errors occur make the error code go to 1 */
  120.  
  121. /* Instructions and Error Displays */
  122.  
  123. if (error1==1)  /* If a number input is wrong display the following message */
  124. {printf ("Please enter 8 numbers in 4 pairs, The first of each pair must be between 0 and 37\n");
  125. printf ("37 is used in place of 00, The first number is the number you are betting on\n");
  126. printf ("The second number is the amount of money you are betting\n\n");
  127. printf ("At least one of the chosen numbers is not on the board, choose another number!");}
  128. else
  129. {if (error2==1)      /* If a bet input is too high, display the following message */
  130. {printf ("Please enter 8 numbers in 4 pairs, The first of each pair must be between 0 and 37\n");
  131. printf ("37 is used in place of 00, The first number is the number you are betting on\n");
  132. printf ("The second number is the amount of money you are betting\n\n");
  133. printf ("At least one of the bets has no value or is too high, choose another bet!");}
  134. else
  135. {if (error3==1)      /* If a bet input is too low, display the following message */
  136. {printf ("Please enter 8 numbers in 4 pairs, The first of each pair must be between 0 and 37\n");
  137. printf ("37 is used in place of 00, The first number is the number you are betting on\n");
  138. printf ("The second number is the amount of money you are betting\n\n");
  139. printf ("At least one of the bets has no value or is too low, choose another bet!");}
  140. else{
  141.  
  142. /* Random Number Generator */
  143.  
  144. srand( time(0) );
  145. land1 = rand() %38;    /* Selects a random number between 0 and 37 and places under title land1 */
  146. land2 = rand() %38;    /* Selects a random number between 0 and 37 and places under title land2 */
  147. land3 = rand() %38;    /* Selects a random number between 0 and 37 and places under title land3 */
  148. land4 = rand() %38;    /* Selects a random number between 0 and 37 and places under title land4 */
  149.  
  150. /* First Bet */
  151.  
  152. if (land1 == 37)    /* If the result of land1 is equal to 37 (i.e. 00) display the following */
  153. {printf ("The first spin resulted with the ball landing on 00\n",land1);}
  154. else    /* If the result of land1 is not equal to 37 display the following */
  155. {printf ("The first spin resulted with the ball landing on %d\n",land1);}
  156. if (land1 == num1)      /* If the result of land1 is equal to num1 following */
  157. {prof1=bet1*35;      /* prof1 becomes the amount bet multiplied by 35 */
  158. printf ("You chose %d so made %d on the first bet\n", num1, prof1);}
  159. else    /* If the result of land1 is not equal to num1 following */
  160. {prof1=bet1*-1;      /* prof1 becomes the amount bet multiplied by -1 */
  161. printf ("You chose %d so lost %d on the first bet\n", num1, prof1);}
  162.  
  163. /* Second Bet */
  164.  
  165. if (land2 == 37)    /* If the result of land2 is equal to 37 (i.e. 00) display the following */
  166. {printf ("\nThe second spin resulted with the ball landing on 00\n",land2);}
  167. else    /* If the result of land2 is not equal to 37 display the following */
  168. {printf ("\nThe second spin resulted with the ball landing on %d\n",land2);}
  169. if (land2 == num2)      /* If the result of land2 is equal to num2 following */
  170. {prof2=bet2*35;      /* prof2 becomes the amount bet multiplied by 35 */
  171. printf ("You chose %d so made %d on the second bet\n", num2, prof2);}
  172. else    /* If the result of land2 is not equal to num2 following */
  173. {prof2=bet2*-1;      /* prof2 becomes the amount bet multiplied by -1 */
  174. printf ("You chose %d so lost %d on the second bet\n", num2, prof2);}
  175.  
  176. /* Third Bet */
  177.  
  178. if (land3 == 37)    /* If the result of land3 is equal to 37 (i.e. 00) display the following */
  179. {printf ("\nThe third spin resulted with the ball landing on 00\n",land3);}
  180. else    /* If the result of land3 is not equal to 37 display the following */
  181. {printf ("\nThe third spin resulted with the ball landing on %d\n",land3);}
  182. if (land3 == num3)      /* If the result of land3 is equal to num3 following */
  183. {prof3=bet3*35;      /* prof3 becomes the amount bet multiplied by 35 */
  184. printf ("You chose %d so made %d on the third bet\n", num3, prof3);}
  185. else    /* If the result of land3 is not equal to num3 following */
  186. {prof3=bet3*-1;      /* prof3 becomes the amount bet multiplied by -1 */
  187. printf ("You chose %d so lost %d on the third bet\n", num3, prof3);}
  188.  
  189. /* Fourth Bet */
  190.  
  191. if (land4 == 37)    /* If the result of land4 is equal to 37 (i.e. 00) display the following */
  192. {printf ("\nThe fourth spin resulted with the ball landing on 00\n",land4);}
  193. else    /* If the result of land4 is not equal to 37 display the following */
  194. {printf ("\nThe fourth spin resulted with the ball landing on %d\n",land4);}
  195. if (land4 == num4)   /* If the result of land4 is equal to num4 following */ 
  196. {prof4=bet4*35;      /* prof4 becomes the amount bet multiplied by 35 */
  197. printf ("You chose %d so made %d on the fourth bet\n", num4, prof4);}
  198. else    /* If the result of land4 is not equal to num4 following */
  199. {prof4=bet4*-1;      /* prof4 becomes the amount bet multiplied by -1 */
  200. printf ("You chose %d so lost %d on the fourth bet\n", num4, prof4);}
  201.  
  202. /* Total Profit */
  203.  
  204. proftot=prof1+prof2+prof3+prof4;  /* proftot becomes the sum of all the profs */
  205. if (proftot>0)  /* If proftot is greater than 0, display the followinf message */
  206. {printf ("\nIn total you have made %d from the four bets!",proftot);}
  207. else    /* If proftot is not greater than 0, display the followinf message */
  208. {printf ("\nIn total you have lost %d from the four bets!",proftot);}
  209. }}}}