<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3.    set up a database to store the possible bets
  4.    set up a data filling function
  5.    set up the rest of the variables
  6.    fill in all the possible bets to the database
  7.    
  8.    IF the user has put in 4 bets with 4 values
  9.       THEN get the bets from the user
  10.       store the user bets
  11.      
  12.       create a random winning number
  13.       store the random winning number
  14.      
  15.       set the first counter to zero
  16.       WHILE the first counter is less than four
  17.          add one to the counter
  18.          set the second counter to zero
  19.          WHILE the second counter is less than the length of the user input for the bet amount
  20.             add one to the counter
  21.             IF the character being checked is not a number
  22.                THEN display that a non integer or negative number has been input
  23.             END IF
  24.          END WHILE
  25.       END WHILE
  26.       set the first counter to zero
  27.       set the second counter to zero
  28.              
  29.       set the second counter to zero
  30.       set the third counter to zero
  31.       set the fourth counter to zero
  32.       WHILE the second counetr is less than 4
  33.          WHILE the third counter is less than 51
  34.             IF the input to the database for the first bet has been compared successfully
  35.                THEN store the bet that it has made for that bet
  36.                ELSE store that an invalid bet has been made to the fourth counter
  37.             END IF
  38.          END WHILE
  39.       END WHILE
  40.      
  41.       IF the fourth counter is an invalid bet
  42.          THEN display that the first bet is invalid and give a list of options
  43.       END IF
  44.       set the second counter to zero
  45.       set the third counter to zero
  46.       set the fourth counter to zero
  47.      
  48.       WHILE the first counter is less than 4
  49.          WHILE the second counter is less than 19
  50.             IF the random winning number matches the list of winning numebrs in the database for the bet
  51.                THEN the bet is assigned a value to determine whether it has won or not
  52.             END IF
  53.          END WHILE
  54.       END WHILE
  55.     set the first counter to zero
  56.     set the second counter to zero
  57.      
  58.       display the winning random number to the user
  59.      
  60.       WHILE the first counter is less than 4
  61.          IF the assigned determining value is positive
  62.             THEN display what bet they put down
  63.                  that this bet has won
  64.                  how much the bet was
  65.                  how much the bet has won
  66.                 ELSE display that this bet has lost
  67.                    how much this bet lost
  68.          END IF
  69.       END WHILE
  70.      
  71.       display to the user their net profit/loss for the entire 4 bets
  72.      
  73.       ELSE display an error message to inform the user that not all 8 sections have been filled
  74.    END IF
  75. END
  76. */
  77.  
  78. #include <stdio.h>
  79. #include <string.h>
  80. #include <ctype.h>
  81. struct database /* Setting up a struct to hold all the possible bet names, their winning numbers and their mulitplier values for winnings */
  82. {
  83. char name[10];
  84. float winNumber[18][2];
  85. int multiplier;
  86. }data[51];
  87.  
  88. void dataFill(void){ /* Creating a function to fill in all the data to the database struct above */
  89. strcpy(data[0].name, "0");
  90. strcpy(data[0].winNumber[0], "0");
  91. data[0].multiplier = 36;
  92. strcpy(data[1].name, "1");
  93. strcpy(data[1].winNumber[0], "1");
  94. data[1].multiplier = 36;
  95. strcpy(data[2].name, "2");
  96. strcpy(data[2].winNumber[0], "2");
  97. data[2].multiplier = 36;
  98. strcpy(data[3].name, "3");
  99. strcpy(data[3].winNumber[0], "3");
  100. data[3].multiplier = 36;
  101. strcpy(data[4].name, "4");
  102. strcpy(data[4].winNumber[0], "4");
  103. data[4].multiplier = 36;
  104. strcpy(data[5].name, "5");
  105. strcpy(data[5].winNumber[0], "5");
  106. data[5].multiplier = 36;
  107. strcpy(data[6].name, "6");
  108. strcpy(data[6].winNumber[0], "6");
  109. data[6].multiplier = 36;
  110. strcpy(data[7].name, "7");
  111. strcpy(data[7].winNumber[0], "7");
  112. data[7].multiplier = 36;
  113. strcpy(data[8].name, "8");
  114. strcpy(data[8].winNumber[0], "8");
  115. data[8].multiplier = 36;
  116. strcpy(data[9].name, "9");
  117. strcpy(data[9].winNumber[0], "9");
  118. data[9].multiplier = 36;
  119. strcpy(data[10].name, "10");
  120. strcpy(data[10].winNumber[0], "10");
  121. data[10].multiplier = 36;
  122. strcpy(data[11].name, "11");
  123. strcpy(data[11].winNumber[0], "11");
  124. data[11].multiplier = 36;
  125. strcpy(data[12].name, "12");
  126. strcpy(data[12].winNumber[0], "12");
  127. data[12].multiplier = 36;
  128. strcpy(data[13].name, "13");
  129. strcpy(data[13].winNumber[0], "13");
  130. data[13].multiplier = 36;
  131. strcpy(data[14].name, "14");
  132. strcpy(data[14].winNumber[0], "14");
  133. data[14].multiplier = 36;
  134. strcpy(data[15].name, "15");
  135. strcpy(data[15].winNumber[0], "15");
  136. data[15].multiplier = 36;
  137. strcpy(data[16].name, "16");
  138. strcpy(data[16].winNumber[0], "16");
  139. data[16].multiplier = 36;
  140. strcpy(data[17].name, "17");
  141. strcpy(data[17].winNumber[0], "17");
  142. data[17].multiplier = 36;
  143. strcpy(data[18].name, "18");
  144. strcpy(data[18].winNumber[0], "18");
  145. data[18].multiplier = 36;
  146. strcpy(data[19].name, "19");
  147. strcpy(data[19].winNumber[0], "19");
  148. data[19].multiplier = 36;
  149. strcpy(data[20].name, "20");
  150. strcpy(data[20].winNumber[0], "20");
  151. data[20].multiplier = 36;
  152. strcpy(data[21].name, "21");
  153. strcpy(data[21].winNumber[0], "21");
  154. data[21].multiplier = 36;
  155. strcpy(data[22].name, "22");
  156. strcpy(data[22].winNumber[0], "22");
  157. data[22].multiplier = 36;
  158. strcpy(data[23].name, "23");
  159. strcpy(data[23].winNumber[0], "23");
  160. data[23].multiplier = 36;
  161. strcpy(data[24].name, "24");
  162. strcpy(data[24].winNumber[0], "24");
  163. data[24].multiplier = 36;
  164. strcpy(data[25].name, "25");
  165. strcpy(data[25].winNumber[0], "25");
  166. data[25].multiplier = 36;
  167. strcpy(data[26].name, "26");
  168. strcpy(data[26].winNumber[0], "26");
  169. data[26].multiplier = 36;
  170. strcpy(data[27].name, "27");
  171. strcpy(data[27].winNumber[0], "27");
  172. data[27].multiplier = 36;
  173. strcpy(data[28].name, "28");
  174. strcpy(data[28].winNumber[0], "28");
  175. data[28].multiplier = 36;
  176. strcpy(data[29].name, "29");
  177. strcpy(data[29].winNumber[0], "29");
  178. data[29].multiplier = 36;
  179. strcpy(data[30].name, "30");
  180. strcpy(data[30].winNumber[0], "30");
  181. data[30].multiplier = 36;
  182. strcpy(data[31].name, "31");
  183. strcpy(data[31].winNumber[0], "31");
  184. data[31].multiplier = 36;
  185. strcpy(data[32].name, "32");
  186. strcpy(data[32].winNumber[0], "32");
  187. data[32].multiplier = 36;
  188. strcpy(data[33].name, "33");
  189. strcpy(data[33].winNumber[0], "33");
  190. data[33].multiplier = 36;
  191. strcpy(data[34].name, "34");
  192. strcpy(data[34].winNumber[0], "34");
  193. data[34].multiplier = 36;
  194. strcpy(data[35].name, "35");
  195. strcpy(data[35].winNumber[0], "35");
  196. data[35].multiplier = 36;
  197. strcpy(data[36].name, "36");
  198. strcpy(data[36].winNumber[0], "36");
  199. data[36].multiplier = 36;
  200. strcpy(data[37].name, "00");
  201. strcpy(data[37].winNumber[0], "37");
  202. data[37].multiplier = 36;
  203.  
  204. strcpy(data[38].name, "odd");
  205. strcpy(data[38].winNumber[0], "1");
  206. strcpy(data[38].winNumber[1], "3");
  207. strcpy(data[38].winNumber[2], "5");
  208. strcpy(data[38].winNumber[3], "7");
  209. strcpy(data[38].winNumber[4], "9");
  210. strcpy(data[38].winNumber[5], "11");
  211. strcpy(data[38].winNumber[6], "13");
  212. strcpy(data[38].winNumber[7], "15");
  213. strcpy(data[38].winNumber[8], "17");
  214. strcpy(data[38].winNumber[9], "19");
  215. strcpy(data[38].winNumber[10], "21");
  216. strcpy(data[38].winNumber[11], "23");
  217. strcpy(data[38].winNumber[12], "25");
  218. strcpy(data[38].winNumber[13], "27");
  219. strcpy(data[38].winNumber[14], "29");
  220. strcpy(data[38].winNumber[15], "31");
  221. strcpy(data[38].winNumber[16], "33");
  222. strcpy(data[38].winNumber[17], "35");
  223. data[38].multiplier = 2;
  224. strcpy(data[39].name, "even");
  225. strcpy(data[39].winNumber[0], "2");
  226. strcpy(data[39].winNumber[1], "4");
  227. strcpy(data[39].winNumber[2], "6");
  228. strcpy(data[39].winNumber[3], "8");
  229. strcpy(data[39].winNumber[4], "10");
  230. strcpy(data[39].winNumber[5], "12");
  231. strcpy(data[39].winNumber[6], "14");
  232. strcpy(data[39].winNumber[7], "16");
  233. strcpy(data[39].winNumber[8], "18");
  234. strcpy(data[39].winNumber[9], "20");
  235. strcpy(data[39].winNumber[10], "22");
  236. strcpy(data[39].winNumber[11], "24");
  237. strcpy(data[39].winNumber[12], "26");
  238. strcpy(data[39].winNumber[13], "28");
  239. strcpy(data[39].winNumber[14], "30");
  240. strcpy(data[39].winNumber[15], "32");
  241. strcpy(data[39].winNumber[16], "34");
  242. strcpy(data[39].winNumber[17], "36");
  243. data[39].multiplier = 2;
  244. strcpy(data[40].name, "black");
  245. strcpy(data[40].winNumber[0], "2");
  246. strcpy(data[40].winNumber[1], "4");
  247. strcpy(data[40].winNumber[2], "6");
  248. strcpy(data[40].winNumber[3], "8");
  249. strcpy(data[40].winNumber[4], "10");
  250. strcpy(data[40].winNumber[5], "11");
  251. strcpy(data[40].winNumber[6], "13");
  252. strcpy(data[40].winNumber[7], "15");
  253. strcpy(data[40].winNumber[8], "17");
  254. strcpy(data[40].winNumber[9], "20");
  255. strcpy(data[40].winNumber[10], "22");
  256. strcpy(data[40].winNumber[11], "24");
  257. strcpy(data[40].winNumber[12], "26");
  258. strcpy(data[40].winNumber[13], "28");
  259. strcpy(data[40].winNumber[14], "29");
  260. strcpy(data[40].winNumber[15], "31");
  261. strcpy(data[40].winNumber[16], "33");
  262. strcpy(data[40].winNumber[17], "35");
  263. data[40].multiplier = 2;
  264. strcpy(data[41].name, "red");
  265. strcpy(data[41].winNumber[0], "1");
  266. strcpy(data[41].winNumber[1], "3");
  267. strcpy(data[41].winNumber[2], "5");
  268. strcpy(data[41].winNumber[3], "7");
  269. strcpy(data[41].winNumber[4], "9");
  270. strcpy(data[41].winNumber[5], "12");
  271. strcpy(data[41].winNumber[6], "14");
  272. strcpy(data[41].winNumber[7], "16");
  273. strcpy(data[41].winNumber[8], "18");
  274. strcpy(data[41].winNumber[9], "19");
  275. strcpy(data[41].winNumber[10], "21");
  276. strcpy(data[41].winNumber[11], "23");
  277. strcpy(data[41].winNumber[12], "25");
  278. strcpy(data[41].winNumber[13], "27");
  279. strcpy(data[41].winNumber[14], "30");
  280. strcpy(data[41].winNumber[15], "32");
  281. strcpy(data[41].winNumber[16], "34");
  282. strcpy(data[41].winNumber[17], "36");
  283. data[41].multiplier = 2;
  284. strcpy(data[42].name, "1-18");
  285. strcpy(data[42].winNumber[0], "1");
  286. strcpy(data[42].winNumber[1], "2");
  287. strcpy(data[42].winNumber[2], "3");
  288. strcpy(data[42].winNumber[3], "4");
  289. strcpy(data[42].winNumber[4], "5");
  290. strcpy(data[42].winNumber[5], "6");
  291. strcpy(data[42].winNumber[6], "7");
  292. strcpy(data[42].winNumber[7], "8");
  293. strcpy(data[42].winNumber[8], "9");
  294. strcpy(data[42].winNumber[9], "10");
  295. strcpy(data[42].winNumber[10], "11");
  296. strcpy(data[42].winNumber[11], "12");
  297. strcpy(data[42].winNumber[12], "13");
  298. strcpy(data[42].winNumber[13], "14");
  299. strcpy(data[42].winNumber[14], "15");
  300. strcpy(data[42].winNumber[15], "16");
  301. strcpy(data[42].winNumber[16], "17");
  302. strcpy(data[42].winNumber[17], "18");
  303. data[42].multiplier = 2;
  304. strcpy(data[43].name, "19-36");
  305. strcpy(data[43].winNumber[0], "19");
  306. strcpy(data[43].winNumber[1], "20");
  307. strcpy(data[43].winNumber[2], "21");
  308. strcpy(data[43].winNumber[3], "22");
  309. strcpy(data[43].winNumber[4], "23");
  310. strcpy(data[43].winNumber[5], "24");
  311. strcpy(data[43].winNumber[6], "25");
  312. strcpy(data[43].winNumber[7], "26");
  313. strcpy(data[43].winNumber[8], "27");
  314. strcpy(data[43].winNumber[9], "28");
  315. strcpy(data[43].winNumber[10], "29");
  316. strcpy(data[43].winNumber[11], "30");
  317. strcpy(data[43].winNumber[12], "31");
  318. strcpy(data[43].winNumber[13], "32");
  319. strcpy(data[43].winNumber[14], "33");
  320. strcpy(data[43].winNumber[15], "34");
  321. strcpy(data[43].winNumber[16], "35");
  322. strcpy(data[43].winNumber[17], "36");
  323. data[43].multiplier = 2;
  324. strcpy(data[44].name, "1-12");
  325. strcpy(data[44].winNumber[0], "1");
  326. strcpy(data[44].winNumber[1], "2");
  327. strcpy(data[44].winNumber[2], "3");
  328. strcpy(data[44].winNumber[3], "4");
  329. strcpy(data[44].winNumber[4], "5");
  330. strcpy(data[44].winNumber[5], "6");
  331. strcpy(data[44].winNumber[6], "7");
  332. strcpy(data[44].winNumber[7], "8");
  333. strcpy(data[44].winNumber[8], "9");
  334. strcpy(data[44].winNumber[9], "10");
  335. strcpy(data[44].winNumber[10], "11");
  336. strcpy(data[44].winNumber[11], "12");
  337. data[44].multiplier = 3;
  338. strcpy(data[45].name, "13-24");
  339. strcpy(data[45].winNumber[0], "14");
  340. strcpy(data[45].winNumber[1], "15");
  341. strcpy(data[45].winNumber[2], "16");
  342. strcpy(data[45].winNumber[3], "17");
  343. strcpy(data[45].winNumber[5], "18");
  344. strcpy(data[45].winNumber[6], "19");
  345. strcpy(data[45].winNumber[7], "20");
  346. strcpy(data[45].winNumber[8], "21");
  347. strcpy(data[45].winNumber[9], "22");
  348. strcpy(data[45].winNumber[10], "23");
  349. strcpy(data[45].winNumber[11], "24");
  350. data[45].multiplier = 3;
  351. strcpy(data[46].name, "25-36");
  352. strcpy(data[46].winNumber[0], "25");
  353. strcpy(data[46].winNumber[1], "26");
  354. strcpy(data[46].winNumber[2], "27");
  355. strcpy(data[46].winNumber[3], "28");
  356. strcpy(data[46].winNumber[4], "29");
  357. strcpy(data[46].winNumber[5], "30");
  358. strcpy(data[46].winNumber[6], "31");
  359. strcpy(data[46].winNumber[7], "32");
  360. strcpy(data[46].winNumber[8], "33");
  361. strcpy(data[46].winNumber[9], "34");
  362. strcpy(data[46].winNumber[10], "35");
  363. strcpy(data[46].winNumber[11], "36");
  364. data[46].multiplier = 3;
  365. strcpy(data[47].name, "1stcolumn");
  366. strcpy(data[47].winNumber[0], "1");
  367. strcpy(data[47].winNumber[1], "4");
  368. strcpy(data[47].winNumber[2], "7");
  369. strcpy(data[47].winNumber[3], "10");
  370. strcpy(data[47].winNumber[4], "13");
  371. strcpy(data[47].winNumber[5], "16");
  372. strcpy(data[47].winNumber[6], "19");
  373. strcpy(data[47].winNumber[7], "22");
  374. strcpy(data[47].winNumber[8], "25");
  375. strcpy(data[47].winNumber[9], "28");
  376. strcpy(data[47].winNumber[10], "31");
  377. strcpy(data[47].winNumber[11], "34");
  378. data[47].multiplier = 3;
  379. strcpy(data[48].name, "2ndcolumn");
  380. strcpy(data[48].winNumber[0], "2");
  381. strcpy(data[48].winNumber[1], "5");
  382. strcpy(data[48].winNumber[2], "8");
  383. strcpy(data[48].winNumber[3], "11");
  384. strcpy(data[48].winNumber[4], "14");
  385. strcpy(data[48].winNumber[5], "17");
  386. strcpy(data[48].winNumber[6], "20");
  387. strcpy(data[48].winNumber[7], "23");
  388. strcpy(data[48].winNumber[8], "26");
  389. strcpy(data[48].winNumber[9], "29");
  390. strcpy(data[48].winNumber[10], "32");
  391. strcpy(data[48].winNumber[11], "35");
  392. data[48].multiplier = 3;
  393. strcpy(data[49].name, "3rdcolumn");
  394. strcpy(data[49].winNumber[0], "3");
  395. strcpy(data[49].winNumber[1], "6");
  396. strcpy(data[49].winNumber[2], "9");
  397. strcpy(data[49].winNumber[3], "12");
  398. strcpy(data[49].winNumber[4], "15");
  399. strcpy(data[49].winNumber[5], "18");
  400. strcpy(data[49].winNumber[6], "21");
  401. strcpy(data[49].winNumber[7], "24");
  402. strcpy(data[49].winNumber[8], "27");
  403. strcpy(data[49].winNumber[9], "30");
  404. strcpy(data[49].winNumber[10], "33");
  405. strcpy(data[49].winNumber[11], "36");
  406. data[49].multiplier = 3;
  407. strcpy(data[50].name, "topline");
  408. strcpy(data[50].winNumber[0], "0");
  409. strcpy(data[50].winNumber[1], "37");
  410. strcpy(data[50].winNumber[2], "1");
  411. strcpy(data[50].winNumber[3], "2");
  412. strcpy(data[50].winNumber[4], "3");
  413. data[50].multiplier = 7;
  414. }
  415. int main( void )
  416. {
  417. char bets[4][10]; /* Setting up variables needed throughout the program */
  418. char Number[4][10];
  419. char thirtySeven[3]="37";
  420. int betnum=0;
  421. int matchNum1=0;
  422. int matchNum2=0;
  423. int matchNum3=0;
  424. int matchNum4=0;
  425. int i = 0;
  426. int j = 0;
  427. int valid;
  428. int netValue1, netValue2, netValue3, netValue4;
  429. int multiplierValue[4][1];
  430. char randoms[2];
  431.  
  432. struct bet /* Setting up a structure array to store input values */
  433. {
  434. char number[4][10];
  435. char betValue[4][10];
  436. }bet;
  437.  
  438. dataFill(); /* Calling the function to fill in all the data to the database */
  439.  
  440. if(scanf("%s %s %s %s %s %s %s %s", &bets[0], &bet.betValue[0], &bets[1], &bet.betValue[1], &bets[2], &bet.betValue[2], &bets[3], &bet.betValue[3]) == 8){ /* Checking if all 8 inputs have been typed in by comparing scanf */
  441.  
  442.    srand(time(0)); /* Setting a random number (the winning number) to the variable 'randoms' */
  443.    sprintf(&randoms, "%d" , (rand()%38) );
  444.  
  445.    for(i=0; i<4; i++){ /* This uses 'isdigit' to check every character input for the bet amounts to see if non valid inputs are there, only integers are allowed */
  446.    j=0;
  447.    for(j=0; j<strlen(bet.betValue[i]); j++){
  448.    if(!isdigit(bet.betValue[i][j])){
  449.       printf("You have put a non integer value or a negative integer value as your bet amount for bet %d, please put positive integer values in.", i + 1);
  450.       exit(0);
  451.       }}}
  452.    i = 0;
  453.    j = 0;
  454.    
  455.    for(i=0; i<4; i++){ /* This is formatting the data input so that it can be compared properly later and not be read in ascii format */
  456.    strcpy(bet.number[i], bets[i]);
  457.    }
  458.    i = 0;
  459.  
  460.    betnum = 0;
  461.    valid = 0;
  462.    for(betnum=0; betnum<51; betnum++){ /* compares the input to the database and stores what it matches as a number in matchnum2 */
  463.       if(strcmp(bet.number[0], data[betnum].name) == 0){
  464.          matchNum1 = betnum;
  465.          valid = 0;
  466.          break;}
  467.             else{
  468.                  valid = 53;
  469.                 }}
  470.       if(valid == 53){ /* Checks to see if you have put a bet that is not listed in the database and returns an error message */
  471.          printf("You have made an invalid bet with your first bet, choose a bet from the bet table.\n\nThe table of bets are as follows:\nsingle bets of 00 and 0 to 36 such as 1 or 2 or 3 or 4...\nodd\neven\nblack\nred\n1-18\n19-36\n1-12\n13-24\n25-36\n1stcolumn\n2ndcolumn\n3rdcolumn\ntopline");
  472.            exit(0);}
  473.    
  474.  
  475.    betnum = 0;
  476.    valid = 0;
  477.    for(betnum=0; betnum<51; betnum++){ /* compares the input to the database and stores what it matches as a number in matchnum2 */
  478.       if(strcmp(bet.number[1], data[betnum].name) == 0){
  479.          matchNum2 = betnum;
  480.          valid = 0;
  481.          break;}
  482.             else{
  483.                valid = 53;
  484.                 }}
  485.       if(valid == 53){ /* Checks to see if you have put a bet that is not listed in the database and returns an error message */
  486.          printf("You have made an invalid bet with your second bet, choose a bet from the bet table.\n\nThe table of bets are as follows:\nsingle bets of 00 and 0 to 36 such as 1 or 2 or 3 or 4...\nodd\neven\nblack\nred\n1-18\n19-36\n1-12\n13-24\n25-36\n1stcolumn\n2ndcolumn\n3rdcolumn\ntopline");
  487.          exit(0);}
  488.    
  489.    
  490.    betnum = 0;
  491.    valid = 0;
  492.    for(betnum=0; betnum<51; betnum++){ /* compares the input to the database and stores what it matches as a number in matchnum3 */
  493.       if(strcmp(bet.number[2], data[betnum].name) == 0){
  494.          matchNum3 = betnum;
  495.          valid = 0;
  496.          break;}
  497.             else{
  498.                valid = 53;
  499.                 }}
  500.       if(valid == 53){ /* Checks to see if you have put a bet that is not listed in the database and returns an error message */
  501.          printf("You have made an invalid bet with your third bet, choose a bet from the bet table.\n\nThe table of bets are as follows:\nsingle bets of 00 and 0 to 36 such as 1 or 2 or 3 or 4...\nodd\neven\nblack\nred\n1-18\n19-36\n1-12\n13-24\n25-36\n1stcolumn\n2ndcolumn\n3rdcolumn\ntopline");
  502.          exit(0);}
  503.    
  504.    
  505.    betnum = 0;
  506.    valid = 0;
  507.    for(betnum=0; betnum<51; betnum++){ /* compares the input to the database and stores what it matches as a number in matchnum4 */
  508.       if(strcmp(bet.number[3], data[betnum].name) == 0){
  509.          matchNum4 = betnum;
  510.          valid = 0;
  511.          break;}
  512.           else{
  513.                valid = 53;
  514.                 }}
  515.       if(valid == 53){ /* Checks to see if you have put a bet that is not listed in the database and returns an error message */
  516.          printf("You have made an invalid bet with your fourth bet, choose a bet from the bet table.\n\nThe table of bets are as follows:\nsingle bets of 00 and 0 to 36 such as 1 or 2 or 3 or 4...\nodd\neven\nblack\nred\n1-18\n19-36\n1-12\n13-24\n25-36\n1stcolumn\n2ndcolumn\n3rdcolumn\ntopline");
  517.          exit(0);}
  518.    
  519.    j = 0;
  520.    for(j=0; j<19; j++){ /* Compares the random winning number ('randoms') to the list of winning numbers for this bet, if it compares then 'multiplierValue' is assigned a 1 to indicate that the bet has won, if not it is assigned a -1 to indicate that the bet has lost */
  521.       if(strcmp(randoms, data[matchNum1].winNumber[j]) == 0){
  522.         strcpy(multiplierValue[0], "1");   
  523.          break;
  524.          }
  525.         else{   
  526.             strcpy(multiplierValue[0], "-1");
  527.              }}
  528.              
  529.    j = 0;   
  530.    for(j=0; j<19; j++){ /* Compares the random winning number ('randoms') to the list of winning numbers for this bet, if it compares then 'multiplierValue' is assigned a 1 to indicate that the bet has won, if not it is assigned a -1 to indicate that the bet has lost */
  531.       if(strcmp(randoms, data[matchNum2].winNumber[j]) == 0){
  532.            strcpy(multiplierValue[1], "1")
  533.          break;
  534.          }
  535.         else{   
  536.             strcpy(multiplierValue[1], "-1");
  537.              }}
  538.          
  539.    j = 0;   
  540.    for(j=0; j<19; j++){ /* Compares the random winning number ('randoms') to the list of winning numbers for this bet, if it compares then 'multiplierValue' is assigned a 1 to indicate that the bet has won, if not it is assigned a -1 to indicate that the bet has lost */
  541.       if(strcmp(randoms, data[matchNum3].winNumber[j]) == 0){
  542.            strcpy(multiplierValue[2], "1");
  543.          break;
  544.          }
  545.         else{   
  546.           strcpy(multiplierValue[2], "-1");
  547.              }}
  548.          
  549.    j = 0;   
  550.    for(j=0; j<19; j++){ /* Compares the random winning number ('randoms') to the list of winning numbers for this bet, if it compares then 'multiplierValue' is assigned a 1 to indicate that the bet has won, if not it is assigned a -1 to indicate that the bet has lost */
  551.       if(strcmp(randoms, data[matchNum4].winNumber[j]) == 0){
  552.            strcpy(multiplierValue[3], "1")
  553.          break;
  554.          }
  555.           else{   
  556.           strcpy(multiplierValue[3], "-1");
  557.              }}
  558.              
  559.    printf("The winning number is %s. (37 = 00)\n", randoms);
  560.  
  561.    if((atoi(multiplierValue[0])) == 1){ /* This then sees if the 'multiplierValue' for this bet is 1 or -1, if 1 then it has won so proceeds to tell the user what bet was placed, the value of the bet and how much you have won, if -1 it tells you the bet placed and how much you have lost */
  562.       printf("Bet 1 of '%s' has won!\nBet 1 was of value %s, you have won a total of %d for this bet!\n", bets[0], bet.betValue[0], data[matchNum1].multiplier * atoi(bet.betValue[0]) );
  563.       netValue1 = (data[matchNum1].multiplier * atoi(bet.betValue[0])); /*Works out the profit and assigns it to 'netValue1' to be used below */
  564.      }
  565.      else{
  566.          printf("Bet 1 of '%s' has lost\nBet 1 has made a loss of %d.\n", bets[0], 1 * atoi(bet.betValue[0]));
  567.          netValue1 = (-1 * atoi(bet.betValue[0])); /* Works out the loss and assigns it to 'netValue1' to be used below */
  568.           }
  569.    
  570.    if((atoi(multiplierValue[1])) == 1){ /* This then sees if the 'multiplierValue' for this bet is 1 or -1, if 1 then it has won so proceeds to tell the user what bet was placed, the value of the bet and how much you have won, if -1 it tells you the bet placed and how much you have lost */
  571.       printf("Bet 2 of '%s' has won!\nBet 2 was of value %s, you have won a total of %d for this bet!\n", bets[1], bet.betValue[1], data[matchNum2].multiplier * atoi(bet.betValue[1]) );
  572.       netValue2 = (data[matchNum2].multiplier * atoi(bet.betValue[1])); /*Works out the profit and assigns it to 'netValue2' to be used below */
  573.       }
  574.      else{
  575.          printf("Bet 2 of '%s' has lost\nBet 2 has made a loss of %d.\n", bets[1], 1 * atoi(bet.betValue[1]));
  576.          netValue2 = (-1 * atoi(bet.betValue[1])); /*Works out the loss and assigns it to 'netValue1' to be used below */
  577.           }
  578.    
  579.    if((atoi(multiplierValue[2])) == 1){ /* This then sees if the 'multiplierValue' for this bet is 1 or -1, if 1 then it has won so proceeds to tell the user what bet was placed, the value of the bet and how much you have won, if -1 it tells you the bet placed and how much you have lost */
  580.       printf("Bet 3 of '%s' has won!\nBet 3 was of value %s, you have won a total of %d for this bet!\n", bets[2], bet.betValue[2], data[matchNum3].multiplier * atoi(bet.betValue[2]) );
  581.       netValue3 = (data[matchNum3].multiplier * atoi(bet.betValue[2])); /*Works out the profit and assigns it to 'netValue3' to be used below */
  582.       }
  583.      else{
  584.          printf("Bet 3 of '%s' has lost\nBet 3 has made a loss of %d.\n", bets[2], 1 * atoi(bet.betValue[2]));
  585.          netValue3 = (-1 * atoi(bet.betValue[2])); /*Works out the loss and assigns it to 'netValue3' to be used below */
  586.           }
  587.    
  588.    if((atoi(multiplierValue[3])) == 1){ /* This then sees if the 'multiplierValue' for this bet is 1 or -1, if 1 then it has won so proceeds to tell the user what bet was placed, the value of the bet and how much you have won, if -1 it tells you the bet placed and how much you have lost */
  589.       printf("Bet 4 of '%s' has won!\nBet 4 was of value %s, you have won a total of %d for this bet!\n", bets[3], bet.betValue[3], data[matchNum4].multiplier * atoi(bet.betValue[3]) );
  590.       netValue4 = (data[matchNum4].multiplier * atoi(bet.betValue[3])); /*Works out the profit and assigns it to 'netValue4' to be used below */
  591.       }
  592.      else{
  593.          printf("Bet 4 of '%s' has lost\nBet 4 has made a loss of %d.\n", bets[3], 1 * atoi(bet.betValue[3]));
  594.          netValue4 = (-1 * atoi(bet.betValue[3])); /*Works out the loss and assigns it to 'netValue4' to be used below */
  595.           }   
  596.          
  597.    printf("\nThe net profit/loss is %d.", (netValue1 + netValue2 + netValue3 + netValue4) ); /* This simply prints the overall profit/loss from the 'netValue' worked out above */
  598.    }
  599.       else{
  600.       printf("You need to put in 8 values in the form 'bet' 'amount' 'bet' 'amount' 'bet' 'amount' 'bet' 'amount' without the quotation marks.\nMake sure all amounts are integer values and the bet is a valid one in the table of bets.\n\nThe table of bets are as follows:\nsingle bets of 00 and 0 to 36 such as 1 or 2 or 3 or 4...\nodd\neven\nblack\nred\n1-18\n19-36\n1-12\n13-24\n25-36\n1stcolumn\n2ndcolumn\n3rdcolumn\ntopline");
  601.         }
  602. }