<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. /*
  6. Start
  7.  
  8. Input Singlebet1 number
  9. Display Errors messages (unexpected messages/missing input values)
  10. Input amount of money for the signlebet1 number
  11. Display Errors messages (unexpected messages/missing input values)
  12.  
  13. Input Singlebet2 number
  14. Display Errors messages (unexpected messages/missing input values)
  15. Input amount of money for the signlebet2 number
  16. Display Errors messages (unexpected messages/missing input values)
  17.  
  18. Input Singlebet3 number
  19. Display Errors messages (unexpected messages/missing input values)
  20. Input amount of money for the signlebet3 number
  21. Display Errors messages (unexpected messages/missing input values)
  22.  
  23. Input Singlebet4 number
  24. Display Errors messages (unexpected messages/missing input values)
  25. Input amount of money for the signlebet4 number
  26. Display Errors messages (unexpected messages/missing input values)
  27.  
  28. spin
  29. Display winning number
  30. Display the payout value
  31.  
  32.    BET1
  33.    Display the number the user bet on, Display the users bet amount
  34.    Display the players profit/loss of that spin
  35.    
  36.    BET2
  37.    Display the number the user bet on, Display the users bet amount
  38.    Display the players profit/loss of that spin   
  39.  
  40.    BET3
  41.    Display the number the user bet on, Display the users bet amount
  42.    Display the players profit/loss of that spin
  43.  
  44.    BET4
  45.    Display the number the user bet on, Display the users bet amount
  46.    Display the players profit/loss of that spin
  47.    
  48.    Display the players total profit/loss of all 4 spins
  49.  
  50. End
  51. */
  52.  
  53. int main( void )
  54.  
  55. {
  56.   int singlebet1,singlebet2,singlebet3,singlebet4;
  57.   double cashbet1,cashbet2,cashbet3,cashbet4,payout = 35;
  58.   double profit = 0;
  59.   double loss = 0;
  60.   int winno;/* winno stands for winning number */
  61.  
  62.   printf( "                                                 Welcome\n");
  63.   printf( "                                            American Roulette\n");
  64.   printf( "   Rules:\n");
  65.   printf( "1. Enter single bet number, between 00, 0-36 & a Cash Bet.\n");
  66.   printf( "2. Please repeat process one four times.\n");
  67.   printf( "3. Please note that the number 37 represents 00 on the wheel.\n\n");
  68.  
  69.   printf( "!Enter your First bet please!\n");
  70.   scanf("%d",&singlebet1); /* USERINPUT-BET1 */
  71.   printf( "Enter Cash amount for First bet\n\n");
  72.   scanf("%lf",&cashbet1); /* USERINPUT-CASHBET1 */
  73.  
  74.   printf( "!Enter your Second bet please!\n");
  75.   scanf("%d",&singlebet2); /* USERINPUT-BET2 */
  76.   printf( "Enter Cash amount for Second bet\n\n");
  77.   scanf("%lf",&cashbet2);/* USERINPUT-CASHBET2 */
  78.  
  79.   printf( "!Enter your Third bet please!\n");
  80.   scanf("%d",&singlebet3); /* USERINPUT-BET3 */
  81.   printf( "Enter Cash amount for Third bet\n\n");
  82.   scanf("%lf",&cashbet3); /* USERINPUT-CASHBET3 */
  83.    
  84.   printf( "!Enter your Fourth bet please!\n");
  85.   scanf("%d",&singlebet4); /* USERINPUT-BET4 */
  86.   printf( "Enter Cash amount for Fourth bet\n\n");
  87.   scanf("%lf",&cashbet4); /* USERINPUT-CASHBET4 */
  88.  
  89.   srand( time(0) );
  90.  
  91.   do
  92. {
  93.   winno = rand();
  94. } while (winno >= 38);
  95.  
  96.   printf("The wheel is spinning\n", winno);
  97.  
  98.  
  99.   if ( winno == 37 ) printf("The ball landed on: 00\n",winno);
  100.   else
  101. {
  102.   printf("The ball landed on: %d\n", winno);
  103. }
  104.   printf("The Payout Value is: %.2lf\n\n", payout);
  105.   scanf("%lf %lf %lf %lf %lf", &singlebet1,&singlebet2,&singlebet3,&singlebet4, &payout);
  106.        
  107.         if (singlebet1 == 37) printf("Bet 1: 00, ",singlebet1);
  108.         else if ( singlebet1 <= 37 ) printf("Bet 1: %d, ",singlebet1);
  109.         else
  110. { 
  111.         printf("ERROR!\n");
  112. }
  113.         printf("cashbet 1: %.2lf\n",cashbet1);
  114.         if ( singlebet1 == winno)
  115. { profit += profit+cashbet1*payout+cashbet1; printf("\n WINNER! WINNER!\n WINNER! WINNER!\n\n You just won: %.2lf\n\n",cashbet1*payout+cashbet1);
  116. }
  117.         else
  118. {
  119.         scanf("%lf", &singlebet1); /* USEROUTPUT-BET1 */
  120.         loss = loss - cashbet1;
  121.         printf("You lost: %.2lf on bet 1\n\n",cashbet1);
  122. }         
  123.           if (singlebet2 == 37) printf("Bet 2: 00, ",singlebet2);
  124.           else if ( singlebet2 <= 37 ) printf("Bet 2: %d, ",singlebet2);
  125.           else
  126. { 
  127.           printf("ERROR!\n");
  128. }
  129.           printf("cashbet 2: %.2lf\n",cashbet2);
  130.           if ( singlebet2 == winno)
  131. { profit += profit+cashbet2*payout+cashbet2; printf("\n WINNER! WINNER!\n WINNER! WINNER!\n\n You just won: %.2lf\n\n",cashbet2*payout+cashbet2);
  132. }
  133.           else
  134. {
  135.           scanf("%lf", &singlebet2); /* USEROUTPUT-BET2 */
  136.           loss = loss - cashbet2;
  137.           printf("You lost: %.2lf on bet 2\n\n",cashbet2);
  138. }
  139.              if (singlebet3 == 37) printf("Bet 3: 00, ",singlebet3);
  140.              else if ( singlebet3 <= 37 ) printf("Bet 3: %d, ",singlebet3);
  141.              else
  142. { 
  143.              printf("ERROR!\n");
  144. }
  145.              printf("cashbet 3: %.2lf\n",cashbet3);             
  146.              if ( singlebet3 == winno)
  147. { profit += profit+cashbet3*payout+cashbet3; printf("\n WINNER! WINNER!\n WINNER! WINNER!\n\n You just won: %.2lf\n\n",cashbet3*payout+cashbet3);
  148. }
  149.              else
  150. {
  151.              scanf("%lf", &singlebet3); /* USEROUTPUT-BET3 */
  152.              loss = loss - cashbet3;
  153.              printf("You lost: %.2lf on bet 3\n\n",cashbet3);
  154. }
  155.                if (singlebet4 == 37) printf("Bet 4: 00, ",singlebet4);
  156.                else if ( singlebet4 <= 37 ) printf("Bet 4: %d, ",singlebet4);
  157.                else
  158. { 
  159.                 printf("ERROR!\n");
  160. }             
  161.                 printf("cashbet 4: %.2lf\n",cashbet4);               
  162.                 if ( singlebet4 == winno)
  163. { profit += profit+cashbet4*payout+cashbet4; printf("\n WINNER! WINNER!\n WINNER! WINNER!\n\n You just won: %.2lf\n\n",cashbet4*payout+cashbet4);
  164. }
  165.                 else
  166. {
  167.                 scanf("%lf", &singlebet4); /* USEROUTPUT-BET4 */
  168.                 loss = loss - cashbet4;
  169.                 printf("You lost: %.2lf on bet 4\n\n",cashbet4);
  170.  }
  171.   printf("You made a Total profit of: %.2lf\n",profit);
  172.   printf("You made a Total loss of: %.2lf\n",loss);
  173.   printf("Total profit: %.2lf\n",profit+loss);
  174.  
  175. }