<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3. SET all 4 bet numbers to zero
  4. SET all 4 bets money to zero
  5. SET moneywon for all bets to zero
  6. SET walet for all bets to zero
  7. SET payouut for all bets to zero
  8. SET profitloss for all bets to zero
  9. SET loss for all bets to zero
  10. SET total zero
  11. SET check to zero
  12. Display welcome to the casino please enter your bet to start
  13. GET 4 bet numbers and money amount
  14. STRCMP reads the bets if the bet number equal to double zero the atoi converts it to double zero
  15.   IF bet number less than zero
  16.    check equal to one
  17.   END IF
  18.   IF bet number less than or equal to zero
  19.    check equal two
  20.   END IF
  21.   IF bet number more than or equal 37
  22.    check equal to three
  23.   END IF
  24.   IF check equal one
  25.    Display error massage please enter positive values
  26.   END IF
  27.   IF check equal two
  28.    Display error massage please enter four pets
  29.   END IF
  30.   IF check equal three
  31.    Display error massage enter bets that is in the range of the rolatre not more than 36
  32.   END IF
  33.   IF cheek equal zero
  34. spin the wheel
  35. IF winning number equal 37
  36. Display winning number equal 00
  37. ELSE
  38. Display the wining number
  39. END IF
  40.   IF winning number equal bet1 number
  41.    THEN
  42.     payout1 equal 35 multiplied by bet 1 money amount
  43.     wallet1 equal payout1+bet 1 money amount
  44.     profitloss1 equal monwywon1 - bet 1 money amount
  45.     display player 1 won
  46.      IF  bet1 equal 37
  47.       display bet 1 equal 00
  48.       ELSE
  49.        display bet 1 number
  50.        display bet 1 money amount
  51.        display payout1
  52.        display wallet1
  53.        display profitloss1
  54.      END IF
  55.   ELSE
  56.    wallet1 equal bet 1 money amount multiplied by -1
  57.    profitloss 1 equal moneywon1 - bet 1 money amount
  58.    display player1 lost
  59.      IF bet1 equal 37
  60.       display bet1 equal 00
  61.       ELSE
  62.        display bet1 number
  63.        display bet 1 mouney amount
  64.        display wallet1
  65.        display profitloss1
  66.      END IF 
  67.   IF winning number equal bet2 number
  68.    THEN
  69.     payout2 equal 35 multiplied by bet 2 money amount
  70.     wallet2 equal payout2+bet 2 money amount
  71.     profitloss2 equal moneywon2 - bet 2 money amount
  72.     display player 2 won
  73.      IF bet2 equal 37
  74.       display bet 2 equal 00
  75.       ELSE
  76.        display bet 2 number
  77.        display bet 2 money amount
  78.        display payout2
  79.        display wallet2
  80.        display profitloss2
  81.      END IF
  82.   ELSE
  83.    wallet2 equal bet 2 money amount multiplied by -1
  84.    profitloss 2 equal moneywon2 - bet 2 money amount
  85.    display player2 lost
  86.      IF bet2 equal 37
  87.       display bet2 equal 00
  88.       ELSE
  89.        display bet2 number
  90.        display bet 2 mouney amount
  91.        display wallet2
  92.        display profitloss2
  93.      END IF
  94.   IF winning number equal bet3 number
  95.    THEN
  96.     payout3 equal 35 multiplied by bet 3 money amount
  97.     wallet3 equal payout3+bet 3 money amount
  98.     profitloss3 equal moneywon3 - bet 3 money amount
  99.     display player 3 won
  100.      IF  bet3 equal 37
  101.       display bet 3 equal 00
  102.       ELSE
  103.        display bet 3 number
  104.        display bet 3 money amount
  105.        display payout3
  106.        display wallet3
  107.        display profitloss3
  108.      END IF
  109.   ELSE
  110. -   wallet3 equal bet 3 money amount multiplied by -1
  111.    profitloss 3 equal moneywon3 - bet 3 money amount
  112.    display player3 lost
  113.      IF bet3 equal 37
  114.       display bet3 equal 00
  115.       ELSE
  116.        display bet3 number
  117.        display bet 3 mouney amount
  118. -       display wallet3
  119.        display profitloss3
  120.      END IF
  121.   IF winning number equal bet4 number
  122.    THEN
  123.     payout4 equal 35 multiplied by bet 4 money amount
  124.     wallet4 equal payout4+bet 4 money amount
  125.     profitloss4 equal moneywon4 - bet 4 money amount
  126.     display player 4 won
  127.      IF bet4 equal 37
  128.       display bet 4 equal 00
  129.       ELSE
  130.        display bet 4 number
  131.        display bet 4 money amount
  132.        display payout4
  133.        display wallet4
  134.        display profitloss4
  135.      END IF
  136.   ELSE
  137.    wallet4 equal bet 4 money amount multiplied by -1
  138.    profitloss 4 equal moneywon4 - bet 4 money amount
  139.    display player4 lost
  140.      IF bet4 equal 37
  141.       display bet4 equal 00
  142.       ELSE
  143.        display bet4 number
  144.        display bet 4 mouney amount
  145. -       display wallet4
  146.        display profitloss4
  147.      END IF 
  148.   END IF
  149. total profitloss equal profitloss1+profitloss2+profitloss3+profitloss4
  150. Display total profitloss
  151. END
  152. */
  153. #include <stdio.h>
  154. #include <stdlib.h>
  155. #include <time.h>
  156. #include <string.h>
  157. int main()
  158. {
  159.  
  160. printf("welcome to the casino please enter your bet to start\n");
  161. char P1B[2];
  162. int P11B=37;
  163. float P1M=0;
  164. char P2B[2];
  165. int P22B=37;
  166. float P2M=0;
  167. char P3B[2];
  168. int P33B=37;
  169. float P3M=0;
  170. char P4B[2];
  171. int P44B=37;
  172. float P4M=0;
  173. char dzero[]="00";
  174. int cheek=0;
  175.  
  176.  
  177. float  moneywon1= 0;
  178. float  moneywon2= 0;
  179. float  moneywon3= 0;
  180. float  moneywon4= 0;
  181. float profitloss1=0;
  182. float profitloss2=0;
  183. float profitloss3=0;
  184. float profitloss4=0;
  185. float Total=0;
  186. float wallet1=0;
  187. float wallet2=0;
  188. float wallet3=0;
  189. float wallet4=0;
  190. float payout1=0;
  191. float payout2=0;
  192. float payout3=0;
  193. float payout4=0;
  194. int check=0;
  195.  
  196. scanf("%s",&P1B);
  197. scanf("%f" ,&P1M);
  198. scanf("%s",&P2B);
  199. scanf("%f" ,&P2M);
  200. scanf("%s ",&P3B);
  201. scanf("%f" ,&P3M);
  202. scanf("%s",&P4B);
  203. scanf("%f" ,&P4M);
  204. /*strncmp function looks at double zero and compares each bet to it and if it is a double zero the atoi
  205. function comverts it to intager */
  206. if (strncmp (dzero,P1B,2))
  207. {P11B=atoi(P1B);}
  208. if (strncmp (dzero,P2B,2))
  209. {P22B=atoi(P2B);}
  210. if (strncmp (dzero,P3B,2))
  211. {P33B=atoi (P3B);}
  212. if (strncmp (dzero,P4B,2))
  213. {P44B=atoi(P4B);}
  214.  
  215. /*checking for errors*/
  216. if(P11B<0)
  217. {check=1;
  218. }
  219. if(P22B<0)
  220. {check=1;
  221. }
  222. if(P33B<0)
  223. {check=1;
  224. }
  225. if(P44B<0)
  226. {check=1;
  227. }
  228. if(P1M<=0)
  229. {check=2;
  230. }
  231. if(P2M<=0)
  232. {check=2;
  233. }
  234. if(P3M<=0)
  235. {check=2;
  236. }
  237. if(P4M<=0)
  238. {check=2;
  239. }
  240. if (P11B>37)
  241. {check=3;}
  242. if (P22B>37)
  243. {check=3;}
  244. if (P33B>37)
  245. {check=3;}
  246. if (P44B>37)
  247. {check=3;}
  248. /*display of erorr messages*/
  249. /*if the bet number is a negative number display error*/
  250. if (check==1)
  251. {printf("error please enter positive bets to play\n");}
  252. /*if the entered bets are less than 4 display error*/
  253. if (check==2)
  254. {printf("error please enter 4 bets to play\n");}
  255. /*if the bet number is more than 36 display error*/
  256. if (check==3)
  257. {printf("error please enter bets number that is in the range of the rolate numbers not more than 36\n ");}
  258.  
  259.  
  260. if(check==0)
  261. {
  262. /*spin the wheel*/
  263. int r;
  264. srand(time(NULL));
  265. r = rand() %38;
  266. if (r==37)
  267. {printf("the wining number is 00\n");
  268. }
  269. else
  270. {printf("the wining number is %d \n",r );}
  271. /*bet1 calculations*/
  272. if (r == P11B)
  273. {
  274. payout1 = (35*P1M);
  275. wallet1 = (payout1 +P1M);
  276. profitloss1=(moneywon1-P1M);
  277. printf("player1 is the winner \n" );
  278. if (P11B==37)
  279. {
  280. printf(" bet1 is 00\n" );}
  281. else{
  282. printf("bet1 is %d \n" ,P11B);}
  283. printf("money amount of bet1 is %.2f\n",P1M);
  284. printf("payout1 = %.2f\n", payout1);
  285. printf("wallet1= %.2f\n",wallet1);
  286. printf("profitloss1= %.2f\n",profitloss1);
  287. }
  288. else {
  289. profitloss1=(moneywon1);
  290. wallet1=( P1M*-1);
  291. printf("player1  lost  \n" );
  292. if (P11B==37)
  293. {
  294. printf(" bet1 is 00\n" );}
  295. else{
  296. printf("bet1 is %d \n" ,P11B);}
  297. printf("money amount of bet1 is %.2f\n",P1M);
  298. printf("wallet1=%.2f\n",wallet1);
  299. printf("profitloss1= %.2f\n",profitloss1);
  300. }
  301. /*bet2 calculations*/
  302. if (r == P22B)
  303. {
  304. payout2 =(35*P2M);
  305. wallet2 =(payout2+P2M);
  306. profitloss2=(moneywon2-P2M);
  307. printf("player2 is the winner \n" );
  308. if (P22B==37)
  309. {
  310. printf(" bet2 is 00\n" );}
  311. else{
  312. printf("bet2 is %d \n" ,P22B);}
  313. printf("money amount of bet2 is %.2f\n",P2M);
  314. printf("payout2 = %.2f\n", payout2);
  315. printf("wallet2= %.2f\n",wallet2);
  316. printf("profitloss2= %.2f\n",profitloss2);
  317. }
  318. else {
  319. profitloss2=(moneywon2);
  320. wallet2=( P2M*-1);
  321. printf("player2 lost  \n" );
  322. if (P22B==37)
  323. {
  324. printf(" bet2 is 00\n" );}
  325. else{
  326. printf("bet2 is %d \n" ,P22B);}
  327. printf("money amount of bet2 is %.2f\n",P2M);
  328. printf("wallet2=%.2f\n",wallet2);
  329. printf("profitloss2= %.2f\n",profitloss2);
  330. }
  331. /*bet3 calculations*/
  332. if (r == P33B)
  333. {
  334. payout3 = ((35*P3M));
  335. wallet3 = (payout3 +P3M);
  336. profitloss3=(moneywon3-P3M);
  337. printf("player3 is the winner\n"  );
  338. if (P33B==37)
  339. {
  340. printf(" bet3 is 00\n" );}
  341. else{
  342. printf("bet3 is %d \n" ,P33B);}
  343. printf("money amount of bet3 is %.2f\n",P3M);
  344. printf("moneywon3 = %.2f\n", payout3);
  345. printf("wallet3= %.2f\n",wallet3);
  346. printf("profitloss3= %.2f\n",profitloss3);
  347. }
  348. else {
  349. profitloss3=(moneywon3);
  350. wallet3=( P3M*-1);
  351. printf("player3  lost  \n" );
  352. if (P33B==37)
  353. {
  354. printf(" bet3 is 00\n" );}
  355. else{
  356. printf("bet3 is %d \n" ,P33B);}
  357. printf("money amount of bet3 is %.2f\n",P3M);
  358. printf("wallet3=%.2f\n",wallet3);
  359. printf("profitloss3= %.2f\n",profitloss3);
  360. }
  361. /*bet4 calculations*/
  362. if (r == P44B)
  363. {
  364. payout4 = (35*P4M);
  365. wallet4 = (payout4 +P4M);
  366. profitloss4=(moneywon4-P4M);
  367. printf("player4 is the winner  \n"  );
  368.  
  369. if (P44B==37)
  370. {
  371. printf(" bet4 is 00\n" );}
  372. else{
  373. printf("bet4 is %d \n" ,P44B);}
  374. printf("money amount of bet4 is %.2f\n",P4M);
  375. printf("payout4 = %.2f\n", payout4);
  376. printf("wallet4= %.2f\n",wallet4);
  377. printf("profitloss4= %.2f\n",profitloss4);
  378. }
  379. else {
  380. wallet4=( P4M*-1);
  381. profitloss4=(moneywon4);
  382. printf("player4 lost \n" );
  383. if (P44B==37)
  384. {
  385. printf(" bet4 is 00\n" );}
  386. else{
  387. printf("bet4 is %d \n" ,P44B);}
  388. printf("money amount of bet4 is %.2f\n",P4M);
  389. printf("wallet4=%.2f\n",wallet4);
  390. printf("profitloss4= %.2f\n",profitloss4);
  391. }
  392. Total=(profitloss1+profitloss2+profitloss3+profitloss4);
  393. printf("total profit loss is %.2f\n",Total);
  394. }
  395.  
  396. }