<mosaic.cnfolio.com>
PROGRAM
1. /*START
2. ask 4 bets followed by 4 values
3. IF the bet is smaller then 0 or greatter that 36
4. THEN
5. use the exit function and display error message
6. END IF
7. IF bet1 equal to double zero
8. THEN
9. covert bet1 to an intger and save it in bet11
10. ELSE
11. bet11 equal 37
12. END IF
13. IF bet2 equal to double zero
14. THEN
15. covert bet2 to an intger and save it in bet12
16. ELSE
17. bet12 equal 37
18. END IF
19. IF bet3 equal to double zero
20. THEN
21. covert bet3 to an intger and save it in bet13
22. ELSE
23. bet13 equal 37
24. END IF
25. IF bet4 equal to double zero
26. THEN
27. covert bet4 to an intger and save it in bet14
28. ELSE
29. bet14 equal 37
30. END IF
31. display the wheel
32. spin the wheel and generate a value which is less that 36 and that is the winning number
33. IF winning number is 37
34. THEN
35. display winning number is 00
36. ELSE
37. display the winning number
38. END IF
39. IF bet11 is equal to the winning number
40. THEN
41. display number that bet11 betted on
42. display amount that bet11 betted on
43. display winning number
44. display payout value which is money1*35
45. display wallet value which is payout value + money1
46. ELSE
47. display number that bet11 betted on
48. display amount that bet11 betted on
49. display winning number
50. display payout value which is 0
51. display wallet value which is money1*-1
52. END IF
53. IF bet12 is equal to the winning number
54. THEN
55. display number that bet12 betted on
56. display amount that bet12 betted on
57. display winning number
58. display payout value which is money2*35
59. display wallet value which is payout value + money2
60. ELSE
61. display number that bet12 betted on
62. display amount that bet12 betted on
63. display winning number
64. display payout value which is 0
65. display wallet value which is money2*-1
66. END IF
67. IF bet13 is equal to the winning number
68. THEN
69. display number that bet13 betted on
70. display amount that bet13 betted on
71. display winning number
72. display payout value which is money3*35
73. display wallet value which is payout value + money3
74. ELSE
75. display number that bet13 betted on
76. display amount that bet13 betted on
77. display winning number
78. display payout value which is 0
79. display wallet value which is money3*-1
80. END IF
81. IF bet14 is equal to the winning number
82. THEN
83. display number that bet14 betted on
84. display amount that bet14 betted on
85. display winning number
86. display payout value which is money4*35
87. display wallet value which is payout value + money4
88. ELSE
89. display number that bet14 betted on
90. display amount that bet14 betted on
91. display winning number
92. display payout value which is 0
93. display wallet value which is money4*-1
94. END IF
95. display the total profit and loss
96. END*/
97. #include <math.h>
98. #include <gdfontg.h>
99. #include <stdio.h>
100. #include <stdlib.h>
101. #include <gd.h>
102. #include <time.h>
103. #include <ctype.h>
104. #include <string.h>
105.
106.
107. #define IMAGE_WIDTH 1300
108. #define IMAGE_HEIGHT 600
109.
110. int main(void)
111. {
112.
113.   FILE *jpgFile = NULL;
114.   gdImagePtr gdImage;
115.   int blue, red, green, black, white, radius1, radius2, textbox[8];
116.   int blacknumbers = 0;
117.   int rednumbers = 0;
118.   int centerx = 240;
119.   int centery = 240;
120.   float angle, circle1x, circle1y, circle2y, cirlce2x, anglevalue, rotate;
121.   char* well={"Welcome to the Casino please enter the 4 bets followed with the amount for each :"};
122.   char num1[255]={"0"};
123.   char num2[255]={"0"};
124.   char num3[255]={"0"};
125.   char num4[255]={"0"};
126.   char num5[255]={"0"};
127.   char num6[255]={"0"};
128.   char num7[255]={"0"};
129.   char num8[255]={"0"};
130.   char num9[255]={"0"};
131.   char num10[255]={"0"};
132.   char num11[255]={"0"};
133.   char num12[255]={"0"};
134.   char num13[255]={"0"};
135.   char num14[255]={"0"};
136.   char num15[255]={"0"};
137.   char num16[255]={"0"};
138.   char num17[255]={"0"};
139.   char num18[255]={"0"};
140.   char num19[255]={"0"};
141.   char num20[255]={"0"};
142.   char num21[255]={"0"};
143.   char num22[255]={"0"};
144.
145.   double money1=-1;
146. double money2=-1;
147. double money3=-1;
148. double money4=-1;
149. double totalprofitloss=0;
150. double profitloss1=0;
151. double profitloss2=0;
152. double profitloss3=0;
153. double profitloss4=0;
154. double moneywon1=0;
155. double moneywon2=0;
156. double moneywon3=0;
157. double moneywon4=0;
158. double totalmoneywon=0;
159. char twozero[] = "00";
160. char bet1[2];
161. char bet2[2];
162. char bet3[2];
163. char bet4[2];
164. int bet11=37;
165. int bet12=37;
166. int bet13=37;
167. int bet14=37;
168. int check = 0;
169. srand(time(NULL));
170. int r = rand()%38;
171.
172.
173. scanf("%s",&bet1);
174. scanf("%lf",&money1);
175. scanf("%s",&bet2);
176. scanf("%lf",&money2);
177. scanf("%s",&bet3);
178. scanf("%lf",&money3);
179. scanf("%s",&bet4);
180. scanf("%lf",&money4);
181.
182. if (strncmp( twozero, bet1, 2 ))
183.    {bet11 = atoi(bet1);}
184.
185.
186. if (strncmp( twozero, bet2, 2 ))
187.    {bet12 = atoi(bet2);;}
188.
189.
190. if (strncmp( twozero, bet3, 2 ))
191.    {bet13 = atoi(bet3);;}
192.
193.
194.
195. if (strncmp( twozero, bet4, 2 ))
196.    {bet14 = atoi(bet4);;}
197.
198. if(bet11<0||bet11>37)
199. { check=1; }
200. if(bet12<0||bet12>37)
201. { check=1; }
202. if(bet13<0||bet13>37)
203. { check=1; }
204. if(bet14<0||bet14>37)
205. { check=1; }
206. if(money1<0)
207. { check=1; }
208. if(money2<0)
209. { check=1; }
210. if(money3<0)
211. { check=1; }
212. if(money4<0)
213. { check=1; }
214.
215.   if(check==1){
216.   printf("please enter a number between 00-36");exit(1);}            /*this is for the error trapping*/
217.
218.
219.
220.   gdImage = gdImageCreate( IMAGE_WIDTH, IMAGE_HEIGHT );
221.   gdImageColorAllocate( gdImage, 0, 128, 0 );
222.
223.
224.   gdImageColorAllocate( gdImage, 154, 205, 50);                                          /* Colours declaration */
225.   blue = gdImageColorAllocate( gdImage, 0, 0, 255 );
226.   red = gdImageColorAllocate( gdImage, 255, 0, 0);
227.   black = gdImageColorAllocate( gdImage, 0, 0, 0);
228.   white = gdImageColorAllocate( gdImage, 255, 255, 255);
229.   gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 226, 30, "0" );
230.   gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 226, 456, "00" )/* Number 0 and 00 is entered manually */
231.   gdImageSetThickness ( gdImage, 3);                                                      /* Image Thickness*/
232.       gdImageArc(gdImage, 240, 240, 478, 478, 0, 360, blue);                                  /* Creation of Big Circle */
233.    gdImageArc(gdImage, 240, 240, 360, 360, 0, 360, blue);                             /* Creation of Small Circle */
234.    /* Face Creation design */
235.
236.   radius1 = 180;                                                                 /* Function to create the lines of the Circle using equation of the Cirlce */
237.   radius2 = 238;
238.   for ( anglevalue = 9.4737; anglevalue <= 360; anglevalue= anglevalue + (9.4737)) /* I found 9.4737 by dividing 360 (Degrees of Circle) by the number of pockets (38) */
239. {
240.       angle = anglevalue * M_PI /180;                   /* The formula to convert degrees to radians is; angle in radians = angle in degrees * Pi / 180. */
241.       float circle1x = (240 + radius1 * cos(angle));    /* x  =  center + radius * cos(angle); is the equation to find the circle center when is not at the origin */
242.       float circle1y = (240 + radius1 * sin(angle));    /* y  =  center + radius * cos(angle); same applies for y */
243.       float circle2x = (240 + radius2 * cos(angle));
244.       float circle2y = (240 + radius2 * sin(angle));
245.       gdImageLine(gdImage, circle1x, circle1y, circle2x, circle2y, blue);
246. }
247.   gdImageLine(gdImage, 420, 240, 480, 240, blue);
248.
249.
250.   radius1 = 210;                                                                    /*Function for black colour*/
251.   radius2 = 220;
252.   for ( anglevalue = 19.2037; anglevalue <= 360; anglevalue= anglevalue + 19.2037)
253. {
254.       angle = anglevalue * M_PI /180 + 300;
255.       float circle1y = (240 + radius1 * sin(angle));
256.       float circle2x = (240 + radius2 * cos(angle));
257.       gdImageFill(gdImage, circle2x, circle1y, black);
258. }
259.
260.   gdImageFill(gdImage, 200, 30, red);
261.
262.
263.   radius1 = 210;                                                                    /* Function for red colour */
264.   radius2 = 220;
265.   for ( anglevalue = 19.2037; anglevalue <= 360; anglevalue = anglevalue + 19.2037)
266. {
267.       angle = anglevalue * M_PI /180 + 815;
268.       float circle1y = (240 + radius1 * sin(angle));
269.       float circle2x = (240 + radius2 * cos(angle));
270.       gdImageFill(gdImage, circle2x, circle1y, red);
271. }
272. gdImageFill(gdImage, 450, 300, red);
273.
274.
275.
276.
277. gdImageFill(gdImage, 450, 300, red);
278.  /* for red numbers */
279. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 300, 450, "5" );
280. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 360, 420, "23" );
281. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 400, 360, "19" );
282. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 430, 300, "21" );
283. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 430, 230, "25" );
284. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 420, 160, "34" );
285. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 380, 110, "27" );
286. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 330, 60, "36" );
287. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 260, 35, "30" );
288. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 192, 35, "23" );
289. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 124, 60, "16" );
290. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 80, 100, "1" );
291. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 30, 165, "14" );
292. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 30, 235, "9" );
293. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 25, 300, "18" );
294. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 50, 370, "7" );
295. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 95, 420, "12" );
296. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 165, 450, "3" );
297.  /* for black numbers */
298. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 260, 450, "15" );
299. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 330, 435, "4" );
300. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 380, 380, "2" );
301. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 425, 330, "17" );
302. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 440, 260, "6" );
303. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 430, 190, "13" );
304. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 400, 135, "11" );
305. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 360, 80, "8" );
306. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 295, 50, "10" );
307. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 160, 50, "24" );
308. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 100, 80, "33" );
309. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 50, 130, "20" );
310. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 30, 200, "31" );
311. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 25, 260, "22" );
312. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 30, 330, "29" );
313. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 70, 390, "28" );
314. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 130, 430, "35" );
315. gdImageStringFT( gdImage, textbox, white, "Vera.ttf", 16, rotate, 190, 450, "26" );
316.
317. gdImageString( gdImage, gdFontGetGiant(), 460, 30, well, white );
318.
319.  /* what happens when bet1 wins */
320.
321.
322. if(r==37){sprintf(num1,"the winning number is 00");
323. }
324. else{sprintf(num1,"the winning number is %d",r);
325. }
326.
327. if (bet11==r&&bet11==37)
328. {sprintf(num2,"bet 1 is on number 00");
329. gdImageString( gdImage, gdFontGetGiant(), 500, 60, num2, white );
330. sprintf(num3,"bet 1 amount of %.2f",money1);
331. gdImageString( gdImage, gdFontGetGiant(), 500, 80, num3, white );
332. gdImageString( gdImage, gdFontGetGiant(), 500, 100, num1, white );
333. moneywon1=0;
334. moneywon1=moneywon1+(money1*35);
335. profitloss1=moneywon1-money1;
336. sprintf(num4,"payout is %.2f ",moneywon1);
337. gdImageString( gdImage, gdFontGetGiant(), 500, 120, num4, white );
338. sprintf(num5,"wallet is %.2f",(money1*36));
339. gdImageString( gdImage, gdFontGetGiant(), 500, 140, num5, white );}
340.  if(bet11==37&&r!=37)
341. {sprintf(num2,"bet 1 is on number 00");
342. gdImageString( gdImage, gdFontGetGiant(), 500, 60, num2, white );
343. sprintf(num3,"bet 1 amount of %.2f",money1);
344. gdImageString( gdImage, gdFontGetGiant(), 500, 80, num3, white );
345. gdImageString( gdImage, gdFontGetGiant(), 500, 100, num1, white );
346. moneywon1=0;
347. profitloss1=moneywon1-money1;
348. sprintf(num4,"payout is 0");
349. gdImageString( gdImage, gdFontGetGiant(), 500, 120, num4, white );
350. sprintf(num5,"wallet is %.2f",(money1*-1));
351. gdImageString( gdImage, gdFontGetGiant(), 500, 140, num5, white );}
352.
353.  if(bet11==r&&bet11!=37)
354. { sprintf(num2,"bet 1 is on number %d",bet11);
355. gdImageString( gdImage, gdFontGetGiant(), 500, 60, num2, white );
356. sprintf(num3,"bet 1 amount of %.2f",money1);
357. gdImageString( gdImage, gdFontGetGiant(), 500, 80, num3, white );
358. gdImageString( gdImage, gdFontGetGiant(), 500, 100, num1, white );
359. moneywon1=0;
360. moneywon1=moneywon1+(money1*35);
361. profitloss1=moneywon1-money1;
362. sprintf(num4,"payout is %.2f ",moneywon1);
363. gdImageString( gdImage, gdFontGetGiant(), 500, 120, num4, white );
364. sprintf(num5,"wallet is %.2f",(money1*36));
365. gdImageString( gdImage, gdFontGetGiant(), 500, 140, num5, white );}
366.  else if(bet11!=r&&bet11!=37)
367. {sprintf(num2,"bet 1 is on number %d",bet11);
368. gdImageString( gdImage, gdFontGetGiant(), 500, 60, num2, white );
369. sprintf(num3,"bet 1 amount of %.2f",money1);
370. gdImageString( gdImage, gdFontGetGiant(), 500, 80, num3, white );
371. gdImageString( gdImage, gdFontGetGiant(), 500, 100, num1, white );
372. moneywon1=moneywon1+(money1*35);
373. moneywon1=0;
374. profitloss1=moneywon1-money1;
375. sprintf(num4,"payout is 0 ");
376. gdImageString( gdImage, gdFontGetGiant(), 500, 120, num4, white );
377. sprintf(num5,"wallet is %.2f",(money1*-1));
378. gdImageString( gdImage, gdFontGetGiant(), 500, 140, num5, white );
379.
380. } /* what happens when bet2 wins */
381.
382. if (bet12==r&&bet12==37)
383. {sprintf(num6,"bet 2 is on number 00");
384. gdImageString( gdImage, gdFontGetGiant(), 1000, 60, num6, white );
385. sprintf(num7,"bet 2 amount of %.2f",money2);
386. gdImageString( gdImage, gdFontGetGiant(), 1000, 80, num7, white );
387. gdImageString( gdImage, gdFontGetGiant(), 1000, 100, num1, white );
388. moneywon2=moneywon2+(money2*35);
389. profitloss2=moneywon2-money2;
390. sprintf(num8,"payout is %.2f ",moneywon2);
391. gdImageString( gdImage, gdFontGetGiant(), 1000, 120, num8, white );
392. sprintf(num9,"wallet is %.2f",(money2*36));
393. gdImageString( gdImage, gdFontGetGiant(), 1000, 140, num9, white );}
394.  if(bet12==37&&r!=37)
395. {sprintf(num6,"bet 2 is on number 00");
396. gdImageString( gdImage, gdFontGetGiant(), 1000, 60, num6, white );
397. sprintf(num7,"bet 2 amount of %.2f",money2);
398. gdImageString( gdImage, gdFontGetGiant(), 1000, 80, num7, white );
399. gdImageString( gdImage, gdFontGetGiant(), 1000, 100, num1, white );
400. moneywon2=0;
401. profitloss2=moneywon2-money2;
402. sprintf(num8,"payout is 0");
403. gdImageString( gdImage, gdFontGetGiant(), 1000, 120, num8, white );
404. sprintf(num9,"wallet is %.2f",(money2*-1));
405. gdImageString( gdImage, gdFontGetGiant(), 1000, 140, num9, white );}
406.
407.  if(bet12==r&&bet12!=37)
408. { sprintf(num10,"bet 2 is on number %d",bet12);
409. gdImageString( gdImage, gdFontGetGiant(), 1000, 60, num10, white );
410. sprintf(num1,"bet 2 amount of %.2f",money2);
411. gdImageString( gdImage, gdFontGetGiant(), 1000, 80, num11, white );
412. gdImageString( gdImage, gdFontGetGiant(), 1000, 100, num1, white );
413. moneywon2=0;
414. moneywon2=moneywon2+(money2*35);
415. profitloss2=moneywon2-money2;
416. sprintf(num12,"payout is %.2f ",moneywon2);
417. gdImageString( gdImage, gdFontGetGiant(), 1000, 120, num12, white );
418. sprintf(num13,"wallet is %.2f",(money2*36));
419. gdImageString( gdImage, gdFontGetGiant(), 1000, 140, num13, white );}
420.  else if(bet12!=r&&bet12!=37)
421. {sprintf(num10,"bet 2 is on number %d",bet12);
422. gdImageString( gdImage, gdFontGetGiant(), 1000, 60, num10, white );
423. sprintf(num11,"bet 2 amount of %.2f",money2);
424. gdImageString( gdImage, gdFontGetGiant(), 1000, 80, num11, white );
425. gdImageString( gdImage, gdFontGetGiant(), 1000, 100, num1, white );
426. profitloss2=moneywon2-money2;
427. sprintf(num12,"payout is 0");
428. gdImageString( gdImage, gdFontGetGiant(), 1000, 120, num12, white );
429. sprintf(num13,"wallet is %.2f",(money2*-1));
430. gdImageString( gdImage, gdFontGetGiant(), 1000, 140, num13, white );
431.
432. } /* what happens when bet3 wins */
433.
434. if (bet13==r&&bet13==37)
435. {sprintf(num14,"bet 3 is on number 00");
436.
437. gdImageString( gdImage, gdFontGetGiant(), 500, 210, num14, white );
438. sprintf(num15,"bet 3 amount of %.2f",money3);
439. gdImageString( gdImage, gdFontGetGiant(), 500, 230, num15, white );
440. gdImageString( gdImage, gdFontGetGiant(), 500, 250, num1, white );
441. moneywon3=moneywon3+(money3*35);
442. profitloss3=moneywon3-money3;
443. sprintf(num16,"payout is %.2f ",moneywon3);
444. gdImageString( gdImage, gdFontGetGiant(), 500, 270, num16, white );
445. sprintf(num17,"wallet is %.2f",(money3*36));
446. gdImageString( gdImage, gdFontGetGiant(), 500, 290, num17, white );}
447.  if(bet13==37&&r!=37)
448. {sprintf(num14,"bet 3 is on number 00");
449. sprintf(num15,"bet 3 amount of %.2f",money3);
450. gdImageString( gdImage, gdFontGetGiant(), 500, 210, num14, white );
451. gdImageString( gdImage, gdFontGetGiant(), 500, 230, num15, white );
452. gdImageString( gdImage, gdFontGetGiant(), 500, 250, num1, white );
453. moneywon3=0;
454. profitloss3=moneywon3-money3;
455. sprintf(num16,"payout is 0");
456. gdImageString( gdImage, gdFontGetGiant(), 500, 270, num16, white );
457. sprintf(num17,"wallet is %.2f",(money3*-1));
458. gdImageString( gdImage, gdFontGetGiant(), 500, 290, num17, white );}
459.
460.  if(bet13==r&&bet13!=37)
461. { sprintf(num14,"bet 3 is on number %d",bet13);
462. sprintf(num15,"bet 3 amount of %.2f",money3);
463. gdImageString( gdImage, gdFontGetGiant(), 500, 210, num14, white );
464. gdImageString( gdImage, gdFontGetGiant(), 500, 230, num15, white );
465. gdImageString( gdImage, gdFontGetGiant(), 500, 250, num1, white );
466. moneywon3=0;
467. moneywon3=moneywon3+(money3*35);
468. profitloss3=moneywon3-money3;
469. sprintf(num16,"payout is %.2f ",moneywon3);
470. gdImageString( gdImage, gdFontGetGiant(), 500, 270, num16, white );
471. sprintf(num17,"wallet is %.2f",(money3*36));
472. gdImageString( gdImage, gdFontGetGiant(), 500, 290, num17, white );}
473.  else if(bet13!=r&&bet13!=37)
474. {sprintf(num14,"bet 3 is on number %d",bet13);
475. sprintf(num15,"bet 3 amount of %.2f",money3);
476. gdImageString( gdImage, gdFontGetGiant(), 500, 210, num14, white );
477. gdImageString( gdImage, gdFontGetGiant(), 500, 230, num15, white );
478. gdImageString( gdImage, gdFontGetGiant(), 500, 250, num1, white );
479. moneywon3=moneywon3+(money3*35);
480. moneywon3=0;
481. profitloss3=moneywon3-money3;
482. sprintf(num16,"payout is 0 ");
483. gdImageString( gdImage, gdFontGetGiant(), 500, 270, num16, white );
484. sprintf(num17,"wallet is %.2f",(money3*-1));
485. gdImageString( gdImage, gdFontGetGiant(), 500, 290, num17, white );
486.
487. } /* what happens when bet4 wins */
488.
489. if (bet14==r&&bet14==37)
490. {sprintf(num18,"bet 4 is on number 00");
491. gdImageString( gdImage, gdFontGetGiant(), 1000, 210, num18, white );
492. sprintf(num19,"bet 4 amount of %.2f",money4);
493. gdImageString( gdImage, gdFontGetGiant(), 1000, 230, num19, white );
494. gdImageString( gdImage, gdFontGetGiant(), 1000, 250, num1, white );
495. moneywon4=moneywon4+(money4*35);
496. profitloss4=moneywon4-money4;
497. sprintf(num20,"payout is %.2f ",moneywon4);
498. gdImageString( gdImage, gdFontGetGiant(), 1000, 270, num20, white );
499. sprintf(num21,"wallet is %.2f",(money4*36));
500. gdImageString( gdImage, gdFontGetGiant(), 1000, 290, num21, white );}
501.  if(bet14==37&&r!=37)
502. {sprintf(num18,"bet 4 is on number 00");
503. gdImageString( gdImage, gdFontGetGiant(), 1000, 110, num18, white );
504. sprintf(num19,"bet 4 amount of %.2f",money4);
505. gdImageString( gdImage, gdFontGetGiant(), 1000, 230, num19, white );
506. gdImageString( gdImage, gdFontGetGiant(), 1000, 250, num1, white );
507. moneywon4=0;
508. profitloss4=moneywon4-money4;
509. sprintf(num20,"payout is 0");
510. gdImageString( gdImage, gdFontGetGiant(), 1000, 270, num20, white );
511. sprintf(num21,"wallet is %.2f",(money4*-1));
512. gdImageString( gdImage, gdFontGetGiant(), 1000, 290, num21, white );}
513.
514.  if(bet14==r&&bet14!=37)
515. { sprintf(num18,"bet 4 is on number %d",bet14);
516. gdImageString( gdImage, gdFontGetGiant(), 1000, 210, num18, white );
517. sprintf(num19,"bet 4 amount of %.2f",money4);
518. gdImageString( gdImage, gdFontGetGiant(), 1000, 230, num19, white );
519. gdImageString( gdImage, gdFontGetGiant(), 1000, 250, num1, white );
520. moneywon4=0;
521. moneywon4=moneywon4+(money4*35);
522. profitloss4=moneywon4-money4;
523. sprintf(num20,"payout is %.2f ",moneywon4);
524. gdImageString( gdImage, gdFontGetGiant(), 1000, 270, num20, white );
525. sprintf(num21,"wallet is %.2f",(money4*36));
526. gdImageString( gdImage, gdFontGetGiant(), 1000, 290, num21, white );}
527.  else if(bet14!=r&&bet14!=37)
528. {sprintf(num18,"bet 4 is on number %d",bet14);
529. gdImageString( gdImage, gdFontGetGiant(), 1000, 210, num18, white );
530. sprintf(num19,"bet 4 amount of %.2f",money4);
531. gdImageString( gdImage, gdFontGetGiant(), 1000, 230, num19, white );
532. gdImageString( gdImage, gdFontGetGiant(), 1000, 250, num1, white );
533. moneywon4=moneywon4+(money4*35);;
534. moneywon4=0;
535. profitloss4=moneywon4-money4;
536. sprintf(num20,"payout is 0");
537. gdImageString( gdImage, gdFontGetGiant(), 1000, 270, num20, white );
538. sprintf(num21,"wallet is %.2f",(money4*-1));
539. gdImageString( gdImage, gdFontGetGiant(), 1000, 290, num21, white );
540.
541. }
542.
543. totalmoneywon=moneywon1+moneywon2+moneywon3+moneywon4;
544. totalprofitloss=totalmoneywon-(money1+money2+money3+money4);
545.
546.
547.
548.
549.
550.
551.
552. if (bet11==r)
553. {sprintf(num22,"the total profit and loss is %.2f",totalprofitloss+money1);
554. gdImageString( gdImage, gdFontGetGiant(), 650, 350, num22, white );}
555.
556. else if (bet12==r)
557. {sprintf(num22,"the total profit and loss is %.2f",totalprofitloss+money2);
558. gdImageString( gdImage, gdFontGetGiant(), 650, 350, num22, white );}
559.
560.  else if (bet13==r)
561. {sprintf(num22,"the total profit and loss is %.2f",totalprofitloss+money3);
562. gdImageString( gdImage, gdFontGetGiant(), 650, 350, num22, white );}
563.
564.  else if (bet14==r)
565. {sprintf(num22,"the total profit and loss is %.2f",totalprofitloss+money4);
566. gdImageString( gdImage, gdFontGetGiant(), 650, 350, num22, white );}
567.
568. else {sprintf(num22,"the total profit and loss is %.2f",totalprofitloss);
569. gdImageString( gdImage, gdFontGetGiant(), 650, 350, num22, white );}
570.
571.
572.
573.
574.
575.  jpgFile = fopen( "test.jpg", "wb" );
576.   gdImageJpeg( gdImage, jpgFile, -1 );
577.
578.
579.   fclose( jpgFile );
580.   gdImageDestroy( gdImage );
581.
582.   }