fork download
  1. #include <stdio.h>
  2.  
  3. // supporting structures
  4. // used as types for members of the two main structures
  5.  
  6. struct date
  7. {
  8. int month;
  9. int day;
  10. int year;
  11. };
  12.  
  13. struct time
  14. {
  15. int hour;
  16. int minute;
  17. int second;
  18. };
  19.  
  20. struct name
  21. {
  22. char firstName[20];
  23. char middleInitial; // not always used
  24. char lastName[20];
  25. };
  26.  
  27. struct stats_record
  28. {
  29. int starts; // total for horse or jockey, not always used
  30. int wins; // total for horse or jockey
  31. int places; // total for horse or jockey
  32. int shows; // total for horse or jockey
  33. };
  34.  
  35. struct statistics
  36. {
  37. struct name statsName; // name of trainer or jockey
  38. struct stats_record startWinPlaceShow;
  39. };
  40.  
  41. struct win_place_show
  42. {
  43. char winName[20];
  44. int winNumber;
  45. char placeName[20];
  46. int placeNumber;
  47. char showName[20];
  48. int showNumber;
  49. };
  50.  
  51. union race_distance
  52. {
  53. char text[20]; // e.g., "Seven Furlongs"
  54. float furlongs; // numeric for calculations
  55. };
  56.  
  57. struct race_condition
  58. {
  59. float purse; // prize money
  60. char detailedRaceDesc[100];
  61. char restriction [20]; // age restriction/condition
  62. char weightAssignments[10];
  63. char claimingCondition[80];
  64. union race_distance raceDistance;
  65. };
  66.  
  67. struct track_record_holder
  68. {
  69. char horsesName[20];
  70. int horsesAge;
  71. int weightCarried; // lbs
  72. struct time horsesTime;
  73. struct stats_record recordHoldersRaceRecord;
  74. };
  75.  
  76. enum medication // "med_" prefix prevents name collisions, strip before printing
  77. {
  78. med_B, // bute
  79. med_L, // lasix
  80. med_A, // adjunct medication
  81. med_C, // 1st time bute
  82. med_M // 1st time lasix
  83. };
  84.  
  85. enum equipment // "equip_" prefix prevents name collisions, strip before printing
  86. {
  87. equip_a, // aluminum pads
  88. equip_b, // blinkers
  89. equip_c, // mud caulks
  90. equip_d, // glued shoes
  91. equip_e, // inner rims
  92. equip_f, // front bandages
  93. equip_g, // goggles
  94. equip_h, // outer rims
  95. equip_i, // inserts
  96. equip_j, // aluminum pad
  97. equip_k, // flipping halter
  98. equip_l, // bar shoes
  99. equip_m, // blocks
  100. equip_n, // no whip
  101. equip_o, // blinker off
  102. equip_p, // pads
  103. equip_q, // nasal strip off
  104. equip_r, // bar shoe
  105. equip_s, // nasal strip
  106. equip_t, // turndowns
  107. equip_u, // spurs
  108. equip_w, // queen's plates
  109. equip_y, // no shoes
  110. equip_z, // tongue tie
  111. equip_1, // running w's
  112. equip_2, // screens
  113. equip_3 // shields
  114. };
  115.  
  116. struct medication_equipment
  117. {
  118. enum medication medicationCode; // L for Lasix
  119. enum equipment equipmentCode; // g for goggles
  120. };
  121.  
  122. enum horse_color // "color_" prefix prevents name collisions, strip before printing
  123. {
  124. color_b, // bay
  125. color_bl, // black
  126. color_br, // brown
  127. color_ch, // chestnut
  128. color_gr, // grey
  129. color_ro, // roan
  130. color_wh // white
  131. };
  132.  
  133. enum horse_gender // "gender_" prefix prevents name collisions, strip before printing
  134. {
  135. gender_g, // gelding
  136. gender_c, // colt
  137. gender_f, // filly
  138. gender_m, // mare
  139. gender_r // rig
  140. };
  141.  
  142. struct horse_info
  143. {
  144. enum horse_color horseColor; // b for bay, bl for black, etc
  145. enum horse_gender horseGender; // c for colt, m for mare, etc
  146. int horseAge;
  147. char sire[20]; // father
  148. char dam[20]; // mother
  149. };
  150.  
  151. struct totals
  152. {
  153. char totalsCategory[12]; // 2024, Life, AllWeather, Dirt, etc
  154. struct stats_record totalStats; // starts, wins, place, show
  155. int speedFigure;
  156. int earnings; // whole dollar amounts
  157. };
  158.  
  159. struct track_and_race
  160. {
  161. char trackCode[3]; // short for name of racetrack
  162. int raceNumber;
  163. };
  164.  
  165. struct final_position
  166. {
  167. int place;
  168. float lengths; // fractional, lengths behind leader or lengths in front
  169. };
  170.  
  171. struct finisher
  172. {
  173. char horseName[20];
  174. int weightCarried;
  175. float lengths; // fractional, lengths behind next position when crossing finish
  176. };
  177.  
  178. enum track_condition // "track_" prefix prevents name collisions, strip before printing
  179. {
  180. track_FT, // fast
  181. track_WF, // wet fast
  182. track_GD, // good
  183. track_SL, // slow
  184. track_MY, // muddy
  185. track_SY, // sloppy
  186. track_FRM, // firm
  187. track_YLD, // yielding
  188. track_SF, // soft
  189. track_HY // heavy
  190. };
  191.  
  192. enum race_type // "race_" prefix prevents name collisions, strip before printing
  193. {
  194. race_Msw, // maiden special weight
  195. race_Clm, // claiming
  196. race_Alw, // allowance
  197. race_Str, // starter allowance
  198. race_Cst, // claiming stakes
  199. race_Moc, // maiden optional claiming
  200. race_Inv, // invitational
  201. race_Trl, // trials
  202. race_Stk, // stakes
  203. race_Mcl, // maiden claiming
  204. race_Aoc, // allowance optional claiming
  205. race_Hcp, // handicap
  206. race_Shp, // starter handicap
  207. race_Soc, // starter optional claiming
  208. race_Mst, // maiden stakes
  209. race_Dby, // derby
  210. race_Ftr // futurity
  211. };
  212.  
  213. struct past_race
  214. {
  215. struct date raceDate; // item 16
  216. struct track_and_race trackRace; // item 17
  217. enum track_condition trackCondition; // item 18, GD for Good, FRM for Firm
  218. union race_distance raceDistance; // item 20, in furlongs or miles (sometimes not whole like 1.70)
  219. int daysUnraced; // item 21
  220. struct time fractionalTimes[2]; // item 22
  221. char ageRestrictionLimit[3]; // item 23, stored as 2 characters for an age, and 1 character to denote R or L
  222. int restrictedToFillies; // item 24, flag
  223. int restrictedToStateBredHorses; // item 25, flag
  224. enum race_type raceType; // item 26, eg: Mst for maiden stakes
  225. int equibasePaceFigures; // item 27
  226. int speedFigure; // item 28
  227. int postPostion; // item 29
  228. float pointCalls[2]; // item 30, fractional
  229. struct final_position finalPosition; // item 31
  230. struct name jockeyName; // item 32
  231. int weightCarried; // item 33
  232. struct medication_equipment medEquip; // item 34
  233. float finalOdds; // item 35
  234. struct finisher topThree[3]; // item 36
  235. char shortFootnotes[30]; // item 37
  236. int numberOfHorses; // item 38
  237. };
  238.  
  239. struct claiming_information
  240. {
  241. struct name newOwner;
  242. struct name previousOwner;
  243. int claimingPrice; // whole dollars
  244. struct name formerTrainer;
  245. };
  246.  
  247. struct workout_lines
  248. {
  249. struct date workoutDate;
  250. char racetrackName[3]; // assuming all track names are shortened to 3 chars
  251. union race_distance trackDistance; // in furlongs
  252. enum track_condition trackCondition; // GD for Good, FRM for Firm
  253. struct time workoutTime;
  254. int breezing; // 1 if breezing, 0 if handily
  255. char rank[5]; // xx out of yy, seperated by a slash char
  256. };
  257.  
  258. // main structure to store details on each race
  259.  
  260. typedef struct race_details
  261. {
  262.  
  263. struct date raceDate; // A - the date of the race
  264. int raceNumber; // C - the specific race number identifier
  265. char trackName[50]; // E - the name of the track where the race was held
  266. int raceRating; // G - the earning estimate for the race winner
  267. struct win_place_show notes; // H - notes area for the top 3 horses in the race
  268. enum race_type raceType; // I - the type of race (eg: maiden claiming is mcl)
  269. struct race_condition condition; // J - the conditions of the race
  270. struct track_record_holder trackRecord; // K - info about the track record holding horse
  271.  
  272. } RACE_DETAILS;
  273.  
  274. // main structure to store details on each horse
  275.  
  276. typedef struct horse_details_and_past_performance
  277. {
  278.  
  279. int programNumber; // 1 - the number of the horse being bet on
  280. char saddleClothColor[12]; // 2 - the color of cloth
  281. char morningLineOdds[3]; // 3 - the final assigned odds when the horse leaves the post
  282. int claimingPrice; // 4 - the horses sale price (whole dollars assumed)
  283. char owner[50]; // 5 - the owner of the horse
  284. char silks[50]; // 6 - the jockey jacket color
  285. struct statistics trainer; // 7 - the trainer name and info (starts, wins, places, shows)
  286. char horseName[20]; // 8 - the name of the horse
  287. struct medication_equipment medEquip; // 9 - the medication and equipment used by the horse
  288. struct horse_info horsesInfo; // 10 - the color, gender, age, sire, and dam
  289. int weightCarried; // 11 - the weight carried by the horse (lbs)
  290. struct statistics jockey; // 12 - the jockey name and info (starts, wins, places, shows)
  291. int horseClassFigure; // 13 - the estimate of what the starter will earn
  292. struct totals totalsGeneral[4]; // 14 - basic prior race stats
  293. struct totals totalsEnvironmental[4]; // 15 - basic prior race stats
  294. struct past_race priorRaceStats[5]; // 16-38 - detailed prior race information
  295. struct claiming_information claimInfo; // 39 - new and previous owner info
  296. struct workout_lines workoutLines[4]; // 40 - insight into the horses fitness and readiness
  297.  
  298. } HORSE_DETAILS;
  299.  
  300. int main ( )
  301. {
  302.  
  303. // declare structs to test compile
  304. // typedefs were intentionally made only for structures declared in main
  305. RACE_DETAILS myRaces[10];
  306. HORSE_DETAILS myHorses[20];
  307.  
  308. return (0);
  309. };
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty