<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. PSEUDOCODE
  3. Define FirstBet SecondBet ThirdBet and FourthBet as integers
  4. Define FirstBet SecondBet ThirdBet and FourthBet as Float
  5. Set FirstResult <- 0
  6. Set SecondResult <- 0
  7. Set ThirdResult <- 0
  8. Set FourthResult <- 0
  9. Set FirstPay  <-0
  10. Set SecondPay  <-0
  11. Set ThirdPay  <-0
  12. Set FourthPay <-0
  13. Input (FirstBet, FirstBetPrice, SecondBet, SecondBetPrice, ThirdBet, ThirdBetPrice, FourthBet, FourthBetPrice);
  14. First Result gives random number less than 38
  15. Second Result gives random number less than 38
  16. Third Result gives random number less than 38
  17. Fourth Result gives random number less than 38
  18. Output (The Royal Casino!!! \n");
  19. Output("| Please place your bets,best of Luck \n")
  20. Output("| ( Note: enter the number '37' into the machine to place your bet) \n \n")
  21.  
  22. Output(FirstBet)
  23. If FirstBet is less than 38 and FirstBet is greater than and equals to 0 then
  24. If FirstBet is 37 then
  25. Output(First Bet number is 00)
  26. Else output(Your First Bet number is %d \n", FirstBet)
  27. Output(Your First bet number is %d \n", FirstBet)
  28. If FirstResult is equal to  37 then
  29. Output("The winning number is 00 \n")
  30. Else Output ("The First winning bet number is %d \n", FirstResult);
  31. If First Bet <-FIRrst result,First pay is <-FirstBet times multi
  32. TotalPay <- TotalPay plus FirstPay plus FirstBet
  33. Output ("You have won! Your FirstBet amount is %.2f \n", FirstPay+FirstBet);
  34.   Output("Your sum is %.2f \n", TotalPay);
  35. else
  36. FirstPay is <- Firstbet price
  37. TotalPay<- TotalPay minus FirstPay
  38. Output("You Lose!You have lost an amoout of -%.2f \n", FirstPay)
  39.   Output("Your sum is %.2f \n \n \n", TotalPay)
  40. Else
  41. Output ("The FirstBet number entered is not accpeptable, please try again \n \n \n")
  42.  
  43. Output(Second bet)
  44. If SecondBet is less than 38 and SecondBet is greater than and equals to 0 then
  45. If SecondBet is 37 then
  46. Output(SecondBet number is 00)
  47. Else output(Your second bet number is %d \n", SecondBet)
  48. Output(Your Second Bet number is %d \n", SecondBet)
  49. If SecondResult is equal to  37 then
  50. Output("The winning number is 00 \n")
  51. Else Output ("The Second winning Bet number is %d \n", SecondResult)
  52. If SecondBet <-SecondResult,SecondPay is <-SecondBet times multi
  53. TotalPay <- TotalPay plus SecondPay plus SecondBet
  54. Output ("You have won! Your SecondBet amount is %.2f \n", SecondPay+SecondBet)
  55.   Output("Your sum is %.2f \n", TotalPay);
  56. else
  57. SecondPay is <- SecondBet price
  58. Totalpay<- TotalPay minus SecondPay
  59. Output("You Lose!You have lost an amoout of -%.2f \n", SecondPay)
  60.   Output("Your sum is %.2f \n \n \n", TotalPay)
  61. Else
  62. Output ("The SecondSet number entered is not accpeptable, please try again \n \n \n")
  63.  
  64. Output(Third bet)
  65. If Thirdbet is less than 38 and ThirdBet is greater than and equals to 0 then
  66. If thirdBet is 37 then
  67. Output(thirdbet number is 00)
  68. Else output(Your thirdbet number is %d \n", ThridBet)
  69. Output(Your ThirdBet number is %d \n", ThirdBet)
  70. If third result is equal to  37 then
  71. Output("The winning number is 00 \n")
  72. Else Output ("The Third  winning bet number is %d \n", ThirdResult)
  73. If ThirdBet <- result,ThirdPay is <-ThirdBet times multi
  74. TotalPay <- TotalPay plus third pay plus ThirdBet
  75. Output ("You have won! Your ThirdBet amount is %.2f \n", ThirdPay+ThirdBet);
  76.   Output("Your sum is %.2f \n", TotalPay)
  77. else
  78. ThirdPay is <- ThirdBet price
  79. Total Pay<- TotalPay minus ThirdPay
  80. Output(printf("You Lose!You have lost an amoout of -%.2f \n", ThirdPay)
  81.   Output("Your sum is %.2f \n \n \n", TotalPay)
  82. Else
  83. Output ("The ThirdBet number entered is not accpeptable, please try again \n \n \n")
  84.  
  85.  
  86. Output(FourthBet)
  87. If FourthBet is less than 38 and FourthBet is greater than and equals to 0 then
  88. If FouthBet is 37 then
  89. Output(Fourthbet number is 00)
  90. Else output(Your FourthBet number is %d \n", FourthBet)
  91. Output(Your FourthBet number is %d \n", FourthBet)
  92. If FourthResult is equal to  37 then
  93. Output("The winning number is 00 \n")
  94. Else Output ("The Fourth winning bet number is %d \n", FourthResult)
  95. If FourthBet <-FourthResult, FourthPay is <-Fourthbet times multi
  96. TotalPay <- TotalPay plus FourthPay plus FourthBet
  97. Output ("You have won! Your FourthBet amount is %.2f \n", FourthPay+ FourthBet)
  98.   Output("Your sum is %.2f \n", TotalPay)
  99. else
  100. FourthPay is <- Fourthbet price
  101. Totalpay<- total pay minus first pay
  102. Output(printf("You Lose!You have lost an amoout of -%.2f \n", FourthPay)
  103.   Output("Your sum is %.2f \n \n \n", TotalPay)
  104. Else
  105. Output ("The fourth bet number entered is not accpeptable, please try again \n \n \n")
  106. Output("The amount you have earned from bets are: %.2f \n \n \n", TotalPay)
  107. Output("Thankyou for playing")
  108. */
  109.  
  110. #include <stdio.h>
  111. #include <stdlib.h>
  112. #include <time.h>
  113.  
  114. int main(void)
  115.    {
  116. int FirstBet;
  117. float FirstBetPrice;
  118. int SecondBet;
  119. float SecondBetPrice;
  120. int ThirdBet;
  121. float ThirdBetPrice;
  122. int FourthBet;
  123. float FourthBetPrice;
  124.  
  125.  
  126. int FirstResult=0;
  127. int SecondResult=0;
  128. int ThirdResult=0;
  129. int FourthResult=0;
  130.  
  131. float FirstPay=0;
  132. float SecondPay=0;
  133. float ThirdPay=0;
  134. float FourthPay=0;
  135. float TotalPay=0;
  136. int multi=35;
  137.  
  138. scanf("%d %f %d %f %d %f %d %f", &FirstBet, &FirstBetPrice, &SecondBet, &SecondBetPrice, &ThirdBet, &ThirdBetPrice, &FourthBet, &FourthBetPrice);
  139.  
  140.    
  141. srand(time(0));
  142. FirstResult = rand()%38;
  143. SecondResult = rand()%38;
  144. ThirdResult = rand()%38;
  145. FourthResult = rand()%38;
  146.  
  147.  
  148. printf("| The Royal Casino!!! \n");
  149. printf("| Please place your bets,best of Luck \n");
  150. printf("| ( Note: enter the number '37' into the machine to place your bet) \n \n");
  151.  
  152.  
  153. printf("| First Bet \n");
  154.  
  155. if (FirstBet  < 38 && FirstBet >= 0)
  156. {
  157. if (FirstBet== 37)
  158. {
  159. printf(" First bet number is 00 \n");
  160.   }
  161. else
  162. {
  163. printf("Your First bet number is %d \n", FirstBet);
  164. }
  165. printf("Your bet is %.2f \n", FirstBetPrice);
  166.  
  167. if (FirstResult== 37)
  168. {
  169.   printf("The winning number is 00 \n");
  170. }
  171. else
  172. {
  173.   printf("The first winning bet number is %d \n", FirstResult);
  174. }
  175.  
  176. if (FirstBet= FirstResult)
  177. {
  178.   FirstPay=(FirstBet*multi);
  179.   TotalPay=(TotalPay+FirstPay+FirstBet);
  180.   printf( "You have won! Your Firstbet amount is %.2f \n", FirstPay+FirstBet);
  181.   printf("Your sum is %.2f \n", TotalPay);
  182.  
  183.   }
  184. else
  185. {
  186.   FirstPay=(FirstBetPrice);
  187.   TotalPay=(TotalPay-FirstPay);
  188.   printf("You Lose!You have lost an amoout of -%.2f \n", FirstPay);
  189.   printf("Your sum is %.2f \n \n \n", TotalPay);
  190.  
  191.   }
  192.   }
  193. else
  194. {
  195. printf("The First bet number entered is not accpeptable, please try again \n \n \n");
  196.    }
  197.    
  198.    printf(" SecondBet \n");
  199.  if (SecondBet < 38 && SecondBet >= 0) 
  200. {
  201.  if (SecondBet == 37)
  202.  {
  203.  printf("Second bet number is 00 \n");
  204.  }
  205.  else
  206.  { printf("Second bet number is %d \n", SecondBet);
  207. }
  208.  printf("Your bet is %.2f \n", SecondBetPrice);
  209. if (SecondResult == 37)
  210. {
  211.  printf("Second winning bet number is 00 \n");
  212.  }
  213.  else
  214. {
  215.  printf(" Second winning bet number is %d \n", SecondResult);
  216. }
  217. if (SecondBet == SecondResult) { SecondPay=(SecondBet*multi); TotalPay=(TotalPay+SecondPay+SecondBet);
  218.  printf("You have won! Your second bet amount is %.2f \n", SecondPay+SecondBet);
  219.  printf("Your subtotal is %.2f \n", TotalPay);
  220.  }
  221.  else { SecondPay=(SecondBetPrice); TotalPay=(TotalPay-SecondPay);
  222.  printf(" Your have lost! In your Second Bet , you have lost an amount of -%.2f \n", SecondPay);
  223.  printf("Your sum is %.2f \n \n \n", TotalPay);
  224.  }
  225.  }
  226.  else
  227.  {
  228. printf("The Second bet number entered is not acceptable, please try again \n \n \n");
  229.   }
  230.  
  231.  
  232. printf("Third Bet \n");
  233. if (ThirdBet < 38 && ThirdBet >= 0)
  234. {
  235.  if (ThirdBet == 37)
  236. {
  237.  printf(" Third bet number is 00 \n");
  238.  }
  239.  else
  240. {
  241.  printf("Third bet number is %d \n", ThirdBet);
  242. }
  243.  printf("Your bet is %.2f \n", ThirdBetPrice);
  244.  if (ThirdResult == 37)
  245. {
  246.  printf("The Third winning bet number is 00 \n");
  247.  }
  248.  else
  249. {
  250.  printf("The third winning bet number is %d \n", ThirdResult);
  251.  }
  252.  if (ThirdBet == ThirdResult) { ThirdPay=(ThirdBet*multi);
  253.  TotalPay=(TotalPay+ThirdPay+ThirdBet);
  254.  printf("You have won! Your third bet amount is %.2f \n", ThirdPay+ThirdBet);
  255.  printf("Your sum is %.2f \n", TotalPay);
  256. }
  257.  else { ThirdPay=(ThirdBet);
  258.  TotalPay=(ThirdPay-ThirdPay);
  259. printf("You lost! In your second bet you have lost an amout of -%.2f \n", ThirdPay);
  260.  printf("Your sum is %.2f \n \n \n", TotalPay);
  261.  }
  262.  }
  263.  else
  264. {
  265.  printf("The Third bet number entered is not acceptable, please try again \n \n \n");
  266.  }
  267.  
  268.  
  269. printf("FourthBet \n");
  270. if(FourthBet < 38 && FourthBet >= 0)
  271. {
  272. if (FourthBet == 37)
  273. {
  274. printf("fourth bet number is 00 \n");
  275.  }
  276.  else
  277.  { printf("Fourth bet number is %d \n", FourthBet);
  278.  }
  279.  printf("Your bet is %.2f \n", FourthBetPrice);
  280. if (FourthResult == 37)
  281. { printf("Fourth winning bet number is 00 \n");
  282.  }
  283.  else
  284.  {
  285.  printf("The fourth winning bet number is %d \n", FourthResult);
  286. }
  287.  if (FourthBet == FourthResult) { FourthPay=( FourthBet*multi);
  288.  TotalPay=(TotalPay+ FourthPay+ FourthBet);
  289. printf("You have won! Your fourth bet amount  is %.2f \n", FourthPay+ FourthBet);
  290. printf("Your sum is %.2f \n", TotalPay);
  291.  }
  292.  else
  293. {
  294. FourthPay=( FourthBetPrice);
  295. TotalPay=( FourthPay- FourthBet);
  296.  printf("You Lose! For your Fourth bet, you have lost an amount of -%.2f \n", FourthPay);
  297.  printf("Your sum is %.2f \n \n \n", TotalPay);
  298. }
  299. }
  300. else
  301.  {
  302.  printf("The Fourth bet number entered is not acceptable, please try again \n \n \n");
  303.  printf("The amount you have earned from bets are: %.2f \n \n \n", TotalPay);
  304.  printf("Thankyou for playing");
  305.  }
  306.  }