<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. Pseudo Code
  3. START
  4. Read 8 inputs
  5. Divide the input in half
  6. Set the first input for single bet number
  7. Set the secound for money amount
  8. Generate a random number
  9. The random number has to be from 1 to 36 or 0 or 00
  10. Set random number as winning number
  11.  
  12. Display the starting message
  13. Display the bet number then the number of bet and money *4
  14. Display which round it is then the random number *4
  15. Display which round it is then won money or lost money *4
  16. Display total loss
  17. Display total won
  18. Display the profit or the loss
  19.  
  20. IF
  21. Input values are smaller then 0
  22.       THEN
  23. Display ERROR message
  24. END IF
  25. IF
  26. Input values are greater then 36
  27.       THEN
  28. Display ERROR message
  29. END IF
  30. IF
  31. Input is not inserted
  32.       THEN
  33. Display ERROR message
  34. END IF
  35.  
  36. Display roulette number
  37. If
  38. Roulette is equal to 37
  39.       THEN
  40. 37 is equal to 00
  41.       Else
  42. it is between 0 to 36
  43.  
  44. IF
  45. Bet numbers equals to roulette
  46.       THEN
  47. Multiply 36 by the bet made, add all the rounds won
  48. Display the amount won money
  49. Display the totalwon bet
  50.       ELSE
  51. Add all the round loss bet
  52. Display totalloss bet
  53.  
  54. subtract totalwon by totalloss
  55. Display the total profit
  56. */
  57.  
  58. #include <stdio.h>
  59. #include <stdlib.h>
  60.  
  61.  
  62. int main()                 
  63. {
  64. int number[4]; /* were using the array, storing the number from 0 to 4 so that we can use it when we want to.*/
  65. int bet[4]; /* were using the array, storing the number from 0 to 4 so that we can use it when we want to.*/
  66. int roulette[4]; /* were using the array, storing the number from 0 to 4 so that we can use it when we want to.*/
  67. int winnings[4]; /* were using the array, storing the number from 0 to 4 so that we can use it when we want to.*/
  68. int loss [4]; /* were using the array, storing the number from 0 to 4 so that we can use it when we want to.*/
  69. int totalwinnings = 0; /* the totalwinnings is set to 0*/
  70. int totalloss = 0; /* the totalloss is set to 0*/
  71.  
  72. printf("Place your 4 bets:\n"); /* this prints "place your 4 bets" to start off the game.*/
  73.  
  74. for (int i = 0;  i<4 ; i++) { //i is set to 0. i++ it increases the number value by one. i<4 its goes from 0 to 4 then loops. This is how loop is created.
  75.  
  76. scanf("%d %d", &number[i], &bet[i]); // This scans the int number and bet. The i is 0
  77. if (number[i] < 0 || bet[i] < 0) {  // ( || ) stands for OR oporetor, if the number and bet is smaller then 0, u have invalid input 
  78. printf ("ERROR: Invalid input, Pick numbers from 0 to 36, insert number to bet and amount of money, 4 times in this sequence. \n"); // This prints of the message
  79. exit(0); // This shuts down all the calling point and shows the error mesasge.
  80. }
  81.  
  82. else if (number[i] > 37) { //if the if statement is not followed then this statement will be used.
  83. printf("ERROR: Check your numbers, Pick numbers from 0 to 36, insert number to bet and amount of money, 4 times in this sequence. \n"); //This shows the message
  84. exit(0); // This shuts down all the calling point and shows the error mesasge.
  85. }
  86.  
  87. else { // if the if and esle if statement does not work then this statement will be used.
  88. printf("Your bet number %d consists of: number %d for $%d\n", i+1, number[i], bet[i]); // i+1 means it adds up the number[i] and bet [i] until it gets to 4.
  89. }
  90. }
  91. printf("\n"); // the \n is used here to make a new line so the above statement does not colide with below statement.
  92. srand(time(NULL));      // This allows for random numbers to be generated every time it is compiled.
  93. for (int i = 0; i<4; i++) { // i is 0, if the number gets from 0 to 4 then it's on a loop.
  94. roulette[i] = (rand() % 38); // This statement gives a random number from 0-37.
  95. if (roulette[i] == 37) { // This statement changes the number 37 to 00.
  96. roulette[i] = 00.00; // if the input is 00 it is known as 37.
  97. printf("Round %d: roulette landed on: %02d\n", i+1, roulette[i]);//The i sets the roulette to 0 and the i+1 adds up until it gets to 4 looping. The %02d does the decimal points. 
  98. }
  99. else{
  100. printf("Round %d: roulette landed on: %d\n", i+1, roulette[i]);//The i sets the roulette to 0 and the i+1 adds up until it gets to 4 looping.
  101. }
  102. }
  103.  
  104. printf("\n");// the \n is used here to make a new line so the above statement does not colide with below statement.
  105.  
  106.  
  107. for (int i = 0; i<4; i++) { // i is 0, if the number gets from 0 to 4 then it's on a loop.
  108. if (number[i] == roulette[i]) { // the operator == checks if the value of number and roulette is equel or not.
  109. winnings[i] = bet[i] + bet[i] *35; // if the number and roulette is same (winnings) then the amount of bet is added with the bet and times by 35.
  110. totalwinnings = totalwinnings + winnings[i]; // to get the totalwinnings it is added by the totalwinnings (0) to winnings [i].
  111. printf("Round %d: You won $%d\n",i+1, winnings[i]); // the i sets the winnings to 0 and the i+1 adds up until it gets to 4 looping.
  112. }
  113.  
  114. else{ // if nothing is won then this statement is followed.
  115. loss[i] = bet[i]; // loss is = bet which is the amount you bet.
  116. totalloss = totalloss + loss[i]; // to get the totalloss, it is added by totalloss (0) to loss[i]
  117. printf("Round %d: You lost $%d\n",i+1, loss[i]); // the i sets the loss to 0 and the i+1 adds up until it gets to 4 looping.
  118. }
  119.  
  120. }
  121. printf("You loss a total of $%d\n", totalloss); // If you get totalloss this prints off
  122. printf("You won a total of $%d\n", totalwinnings); // If totalwinnings then this prints off
  123.  
  124. printf ("If you get negative (-) its your loss, Else it's your profit.( %d )", totalwinnings - totalloss); // To know how much profit is made totalwinnings - totalloss.
  125. }