<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. /*START
  6.        Get input value (player bet amount and money amount)
  7.        Spin the wheel including a 00 (American roullette style)
  8.  
  9. IF    bet number is between o and 37
  10. IF    money amount is a posiove
  11.        
  12.        IF wheel lands on 37
  13.            DISPLAY the first winning number as 00
  14.        ELSE
  15.            DISPLAY the number the wheel lands on
  16.        
  17.        IF first bet number is 37
  18.            DISPLAY first bet number as 00
  19.        ELSE
  20.            DISPLAY the bet number you placed
  21.            DISPLAY your first bet amount
  22.            
  23.        IF your first bet number is the same as the number the roullette wheel lands on
  24.            THEN
  25.                multiply your first bet amount by 35 for the payoutvalue
  26.                add payoutvalue and the first bet amount to your subtotal
  27.            DISPLAY your payoutvalue for the first bet
  28.            DISPLAY your subtotal for the first bet
  29.        ELSE   
  30.                subtract your betamount from your subtotal
  31.            THEN
  32.            DISPLAY message saying your player has lost the bet
  33.            DISPLAY you payoutvalue for the bet in minus
  34.            DISPLAY the subtotal for the bet
  35.            
  36. ELSE
  37.      DISPLAY error message saying the first bet amount is too low
  38.  
  39. END IF
  40.  
  41. ELSE
  42.      DISPLAY error message saying the first bet number is not between 0 and 37
  43.      
  44. END IF
  45.  
  46.       Get input value (player bet amount and money amount)
  47.        Spin the wheel including a 00 (American roullette style)
  48.  
  49. IF    bet number is between o and 37
  50. IF    money amount is a posiove
  51.        
  52.        IF wheel lands on 37
  53.            DISPLAY the second winning number as 00
  54.        ELSE
  55.            DISPLAY the number the wheel lands on
  56.        
  57.        IF second bet number is 37
  58.            DISPLAY second bet number as 00
  59.        ELSE
  60.            DISPLAY the bet number you placed
  61.            DISPLAY your second bet amount
  62.            
  63.        IF your second bet number is the same as the number the roullette wheel lands on
  64.            THEN
  65.                multiply your second bet amount by 35 for the payoutvalue
  66.                add payoutvalue and the second bet amount to your subtotal
  67.            DISPLAY your payoutvalue for the second bet
  68.            DISPLAY your subtotal for the second bet
  69.        ELSE   
  70.                subtract your betamount from your subtotal
  71.            THEN
  72.            DISPLAY message saying your player has lost the bet
  73.            DISPLAY you payoutvalue for the bet in minus
  74.            DISPLAY the subtotal for the bet
  75.            
  76. ELSE
  77.      DISPLAY error message saying the second bet amount is too low
  78.  
  79. END IF
  80.  
  81. ELSE
  82.      DISPLAY error message saying the second bet number is not between 0 and 37
  83.      
  84. END IF
  85.  
  86.       Get input value (player bet amount and money amount)
  87.        Spin the wheel including a 00 (American roullette style)
  88.  
  89. IF    bet number is between o and 37
  90. IF    money amount is a positive
  91.        
  92.        IF wheel lands on 37
  93.            DISPLAY the third winning number as 00
  94.        ELSE
  95.            DISPLAY the number the wheel lands on
  96.        
  97.        IF third bet number is 37
  98.            DISPLAY third bet number as 00
  99.        ELSE
  100.            DISPLAY the bet number you placed
  101.            DISPLAY your third bet amount
  102.            
  103.        IF your third bet number is the same as the number the roullette wheel lands on
  104.            THEN
  105.                multiply your third bet amount by 35 for the payoutvalue
  106.                add payoutvalue and the third bet amount to your subtotal
  107.            DISPLAY your payoutvalue for the third bet
  108.            DISPLAY your subtotal for the third bet
  109.        ELSE   
  110.                subtract your betamount from your subtotal
  111.            THEN
  112.            DISPLAY message saying your player has lost the bet
  113.            DISPLAY you payoutvalue for the bet in minus
  114.            DISPLAY the subtotal for the bet
  115.            
  116. ELSE
  117.      DISPLAY error message saying the third bet amount is too low
  118.  
  119. END IF
  120.  
  121. ELSE
  122.      DISPLAY error message saying the third bet number is not between 0 and 37
  123.      
  124. END IF
  125.  
  126.       Get input value (player bet amount and money amount)
  127.        Spin the wheel including a 00 (American roullette style)
  128.  
  129. IF    bet number is between 0 and 37
  130. IF    money amount is a positive
  131.        
  132.        IF wheel lands on 37
  133.            DISPLAY the fourth winning number as 00
  134.        ELSE
  135.            DISPLAY the number the wheel lands on
  136.        
  137.        IF fourth bet number is 37
  138.            DISPLAY fourth bet number as 00
  139.        ELSE
  140.            DISPLAY the bet number you placed
  141.            DISPLAY your fourth bet amount
  142.            
  143.        IF your fourth bet number is the same as the number the roullette wheel lands on
  144.            THEN
  145.                multiply your fourth bet amount by 35 for the payoutvalue
  146.                add payoutvalue and the fourth bet amount to your subtotal
  147.            DISPLAY your payoutvalue for the fourth bet
  148.            DISPLAY your subtotal for the fourth bet
  149.        ELSE   
  150.                subtract your betamount from your subtotal
  151.            THEN
  152.            DISPLAY message saying your player has lost the bet
  153.            DISPLAY you payoutvalue for the bet in minus
  154.            DISPLAY the subtotal for the bet
  155.            
  156. ELSE
  157.      DISPLAY error message saying the fourth bet amount is too low
  158.  
  159. END IF
  160.  
  161. ELSE
  162.      DISPLAY error message saying the fourth bet number is not between 0 and 37
  163.      
  164. END IF
  165.  
  166. END
  167. */
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175. int main(void)
  176. {
  177. int betnumberone, betnumbertwo, betnumberthree, betnumberfour;// Declaring 4 variables representing my 4 bet bumbers
  178. float betamountone, betamounttwo, betamountthree, betamountfour;//Declaring 4 variables that will represent my the 4 bet amounts
  179. int roulletterollone, roulletterolltwo, roulletterollthree, roulletterollfour;//Here im declaring the roullette variable 4 times
  180. float payoutvalueone, payoutvaluetwo, payoutvaluethree, payoutvaluefour;//Here i decided to declare payoutvalu variable 4 times as they will have to be a payoutvalue being displayed after each bet
  181. float subtotal;//here i am declaring a variable for my subtotal as it this will help calculate the subtotal after each bet
  182. int odds = 35;// i decided to do a variable for the 35-1 odds for the bet as this is what i will use to do my payoutvalue calculation
  183.  
  184. scanf("%d %f %d %f %d %f %d %f", &betnumberone, &betamountone, &betnumbertwo, &betamounttwo, &betnumberthree, &betamountthree, &betnumberfour, &betamountfour);// this scanf will be taking the data from the playesrs bet number inputs and bet amount
  185.  
  186. srand( time( 0 ) );// here i am setting up my random function for the roullette wheel
  187. roulletterollone = rand() % 38;//i am setting my random numbers to have a range of 0 to 38 which will be including my 00
  188. roulletterolltwo = rand() % 38;
  189. roulletterollthree = rand() % 38;
  190. roulletterollfour = rand() % 38;
  191.  
  192. if (betnumberone > -1 && betnumberone <= 38)// here am asking the if the bet number they are placing is between 0 and 38 as those are the valid values for the bet
  193. {
  194. if (betamountone > 0.00)// here i decided to do an if statement to tell the user the bet money amount has to be a positive
  195. {
  196. if (roulletterollone == 37)// i decided to do an if statement here so if the the number on the wheel is 37 it will be represented as 00
  197. {
  198. printf("THE FIRST WINNING NUMBER IS 00!\n");//here i am displayng the 00 if the if statement above it is true
  199. }
  200. else
  201. {
  202. printf("THE FIRST WINNING NUMBER IS %d\n",roulletterollone);// the else statement is too display the original number the roullette lands on if the if statement is false
  203. }
  204. if (betnumberone == 37) // i decided to do an if statement for the player placing a 37 as a bet to represent a 00
  205. {
  206. printf("THE FIRST BET NUMBER IS 00!\n");//if the statement is true the bet number 37 will display in the output as a 00
  207. }
  208. else
  209. {
  210. printf("THE FIRST BET NUMBER IS %d\n",betnumberone);// if the player doesnt place 37 as a bet that means the if statement is false and the output will just display the original bet the player wanted to place
  211. }
  212. printf("YOUR FIRST BET AMOUNT IS %.2f\n",betamountone);//i done this printf so the output displays the bet amount thats also being put with the bet number
  213. if (betnumberone == roulletterollone)// i decided to do this if statement which is asking if the first bet is the same as the number the wheels lands
  214. {
  215.   payoutvalueone=(betamountone*odds);// here i use the odds variable i declared at the top and the betamount i placed on the first bet to calculate the first bets payoutvalue
  216.   subtotal=(subtotal+payoutvalueone+betamountone);// here i used the payoutvalue from the first bet and the bet amount from the first bet to calculate the subtotal for my first bet
  217.   printf("|||||||||||||||| YOU WON!!! |||||||||||||||\n");// here i will display the "YOU WIN " message in the output if the statement is true it then means he player won hes firts bet and
  218.   printf("THE PAYOUT VALUE FOR THIS BET IS %.2f \n", payoutvalueone+betamountone);// i done this printf to display the first payoutvalue plus your money back from the first bet
  219.   printf("THE SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);// the players profit will then be displayed as hes subtotal for the first bet
  220.   }
  221. else
  222. {
  223.   payoutvalueone=(betamountone);// this is for the subtotal to show the loss of the bet and i assigned it lke this to keep it consistent to the win if statement
  224.   subtotal=(subtotal-payoutvalueone); // here i to decide if the if statment is false then the player loses and hes profit will go into the minus
  225.   printf("YOU LOST\n");// if the if statment is proven false i then decided to display a message in the output telling the player he has lost the first bet
  226.   printf("YOUR PAYOUT VALUE FOR THIS BET IS -%.2f \n", payoutvalueone); // here i decided to also display the players payoutvalue in minus after losing the first bet
  227.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);// after i dislaying the players payout i then decided her to display the subtotal loss at the end
  228.   }
  229.   }// this where the second if statement for the bet amount ends
  230. else
  231. {
  232. printf("THE FIRST BET AMOUNT IS TOO LOW\n \n");// i decided to display this error message if the players bet amount is not a positive
  233. }
  234. }//this is where the first if statement for the bet number ends
  235. else
  236. {
  237. printf("THE FIRST BET NUMBER IS NOT IN RANGE\n \n");// i decided to do this error message if the players bet number is not within the range i set in my first if statement
  238.    }// this is where my first bet ends
  239. if (betnumbertwo > -1 && betnumbertwo <= 38)
  240. {
  241. if (betamounttwo > 0.00)
  242. {
  243. if (roulletterolltwo == 37)
  244. {
  245. printf("THE SECOND WINNING NUMBER IS 00!\n");
  246. }
  247. else
  248. {
  249. printf("THE SECOND WINNING NUMBER IS %d\n",roulletterolltwo);
  250. }
  251. if (betnumbertwo == 37)
  252. {
  253. printf("THE SECOND BET NUMBER IS 00!\n");
  254. }
  255. else
  256. {
  257. printf("THE SECOND BET NUMBER IS %d\n",betnumbertwo);
  258. }
  259. printf("YOUR SECOND BET AMOUNT IS %.2f\n",betamounttwo);
  260. if (betnumbertwo == roulletterolltwo)
  261. {
  262.   payoutvaluetwo=(betamounttwo*odds);
  263.   subtotal=(subtotal+payoutvaluetwo+betamounttwo);
  264.   printf("|||||||||||||||| YOU WON!!! |||||||||||||||\n");
  265.   printf("YOUR PAYOUT VALUE FOR THIS BET IS %.2f \n", payoutvaluetwo+betamounttwo);
  266.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);
  267.   }
  268. else
  269. {
  270.   payoutvaluetwo=(betamounttwo);
  271.   subtotal=(subtotal-payoutvaluetwo);
  272.   printf("YOU LOST\n");
  273.   printf("YOUR PAYOUT VALUE FOR THIS BET IS -%.2f \n", payoutvaluetwo);
  274.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);
  275.   }
  276.   }
  277. else
  278. {
  279. printf("THE SECOND BET AMOUNT IS TOO LOW\n \n");
  280. }
  281. }
  282. else
  283. {
  284. printf("THE SECOND BET NUMBER IS NOT IN RANGE\n \n");
  285.    }
  286. if (betnumberthree > -1 && betnumberthree <= 38)
  287. {
  288. if (betamountthree > 0.00)
  289. {
  290. if (roulletterollthree == 37)
  291. {
  292. printf("THE THIRD WINNING NUMBER IS 00!\n");
  293. }
  294. else
  295. {
  296. printf("THE THIRD WINNING NUMBER IS %d\n",roulletterollthree);
  297. }
  298. if (betnumberthree == 37)
  299. {
  300. printf("THE THIRD BET NUMBER IS 00!\n");
  301. }
  302. else
  303. {
  304. printf("THE THIRD BET NUMBER IS %d\n",betnumberthree);
  305. }
  306. printf("YOUR THIRD BET AMOUNT IS %.2f\n",betamountthree);
  307. if (betnumberthree == roulletterollthree)
  308. {
  309.   payoutvaluethree=(betamountthree*odds);
  310.   subtotal=(subtotal+payoutvaluethree+betamountthree);
  311.   printf("|||||||||||||||| YOU WON!!! |||||||||||||||\n");
  312.   printf("YOUR PAYOUT VALUE FOR THIS BET IS %.2f \n", payoutvaluethree+betamountthree);
  313.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);
  314.   }
  315. else
  316. {
  317.   payoutvaluethree=(betamountthree);
  318.   subtotal=(subtotal-payoutvaluethree);
  319.   printf("YOU LOST\n");
  320.   printf("YOUR PAYOUT VALUE FOR THIS BET IS -%.2f \n", payoutvaluethree);
  321.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);
  322.   }
  323.   }
  324. else
  325. {
  326. printf("THE THIRD BET AMOUNT IS TOO LOW\n \n");
  327. }
  328. }
  329. else
  330. {
  331. printf("THE THIRD BET NUMBER IS NOT IN RANGE\n \n");
  332.    }
  333. if (betnumberfour > -1 && betnumberfour <= 38)
  334. {
  335. if (betamountfour > 0.00)
  336. {
  337. if (roulletterollfour == 37)
  338. {
  339. printf("THE FOURTH WINNING NUMBER IS 00!\n");
  340. }
  341. else
  342. {
  343. printf("THE FOURTH WINNING NUMBER IS %d\n",roulletterollfour);
  344. }
  345. if (betnumberfour == 37)
  346. {
  347. printf("THE FOURTH BET NUMBER IS 00!\n");
  348. }
  349. else
  350. {
  351. printf("THE FOURTH BET NUMBER IS %d\n",betnumberfour);
  352. }
  353. printf("YOUR FOURTH BET AMOUNT IS %.2f\n",betamountfour);
  354. if (betnumberfour == roulletterollfour)
  355. {
  356.   payoutvaluefour=(betamountfour*odds);
  357.   subtotal=(subtotal+payoutvaluefour+betamountfour);
  358.   printf("|||||||||||||||| YOU WON!!! |||||||||||||||\n");
  359.   printf("YOUR PAYOUT VALUE FOR THIS BET IS %.2f \n", payoutvaluefour+betamountfour);
  360.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);
  361.   }
  362. else
  363. {
  364.   payoutvaluefour=(betamountfour);
  365.   subtotal=(subtotal-payoutvaluefour);
  366.   printf("YOU LOST\n");
  367.   printf("YOUR PAYOUT VALUE FOR THIS BET IS -%.2f \n", payoutvaluefour);
  368.   printf("YOUR SUBTOTAL FOR THIS BET IS %.2f \n \n", subtotal);
  369.   }
  370.   }
  371. else
  372. {
  373. printf("THE FOURTH BET AMOUNT IS TOO LOW\n \n");
  374. }
  375. }
  376. else
  377. {
  378. printf("THE FOURTH BET NUMBER IS NOT IN RANGE\n \n");
  379.    }
  380. printf("YOUR TOTAL PAYOUT IS %.2f \n", subtotal);
  381. }