fork download
  1. #include <stdio.h>
  2.  
  3. #define MAX_TRACK_NAME 50
  4. #define MAX_HORSE_NAME 50
  5. #define MAX_JOCKEY_NAME 50
  6. #define MAX_TRAINER_NAME 50
  7. #define MAX_OWNER_NAME 50
  8. #define MAX_RACES 10
  9. #define MAX_HORSES 20
  10.  
  11. // supporting date structure
  12. struct date
  13. {
  14. int month;
  15. int day;
  16. int year;
  17. };
  18.  
  19. // supporting time structure
  20. struct race_time
  21. {
  22. int hour;
  23. int minute;
  24. };
  25.  
  26. // enumerated type for race surface
  27. enum race_surface
  28. {
  29. DIRT,
  30. TURF,
  31. SYNTHETIC
  32. };
  33.  
  34. // enumerated type for track condition
  35. enum track_condition
  36. {
  37. FAST,
  38. GOOD,
  39. MUDDY,
  40. SLOPPY,
  41. FIRM,
  42. SOFT
  43. };
  44.  
  45. // enumerated type for horse gender
  46. enum horse_gender
  47. {
  48. MALE,
  49. FEMALE,
  50. GELDING
  51. };
  52.  
  53. // supporting money structure
  54. struct money
  55. {
  56. float amount;
  57. };
  58.  
  59. // supporting odds structure
  60. struct odds
  61. {
  62. int numerator;
  63. int denominator;
  64. };
  65.  
  66. // supporting jockey structure
  67. struct jockey
  68. {
  69. char jockeyName[MAX_JOCKEY_NAME];
  70. float jockeyWeight;
  71. };
  72.  
  73. // supporting trainer structure
  74. struct trainer
  75. {
  76. char trainerName[MAX_TRAINER_NAME];
  77. };
  78.  
  79. // supporting owner structure
  80. struct owner
  81. {
  82. char ownerName[MAX_OWNER_NAME];
  83. };
  84.  
  85. // supporting race record structure
  86. struct past_performance
  87. {
  88. int starts;
  89. int wins;
  90. int places;
  91. int shows;
  92. float earnings;
  93. };
  94.  
  95. // add a structure to store details on each race
  96. struct race_details
  97. {
  98. struct date raceDate; // A - date of the race
  99. struct race_time postTime; // B - race time
  100. int raceNumber; // C - race number
  101. char trackName[MAX_TRACK_NAME]; // E - track name
  102.  
  103. float distance; // race distance
  104. enum race_surface surface; // dirt, turf, synthetic
  105. enum track_condition condition; // track condition
  106. struct money purse; // purse/prize money
  107.  
  108. int numberOfHorses; // number of horses entered
  109. int ageRequirement; // age requirement for horses
  110. char raceType[50]; // claiming, allowance, stakes, etc.
  111. };
  112.  
  113. // add a structure to store details on each horse
  114. struct horse_details_and_past_performance
  115. {
  116. int programNumber; // 1 - program number
  117. int postPosition; // post position
  118. char horseName[MAX_HORSE_NAME]; // 8 - horse name
  119. enum horse_gender horseGender; // 10 - horse gender
  120.  
  121. int horseAge; // horse age
  122. float weightCarried; // assigned weight
  123. struct jockey horseJockey; // jockey information
  124. struct trainer horseTrainer; // trainer information
  125. struct owner horseOwner; // owner information
  126.  
  127. struct odds morningLineOdds; // morning line odds
  128. struct past_performance record; // past performance record
  129.  
  130. int lastRaceFinish; // last finish position
  131. float speedRating; // speed rating
  132. float earningsThisYear; // yearly earnings
  133. };
  134.  
  135. // **************************************************
  136. // Function: main
  137. //
  138. // Description: declares arrays of race and horse
  139. // structures to test that the code compiles
  140. //
  141. // Parameters: none
  142. //
  143. // Returns: 0
  144. //
  145. // **************************************************
  146.  
  147. int main()
  148. {
  149. // NOTE: You do not have to populate these
  150. struct race_details myRaces[MAX_RACES];
  151. struct horse_details_and_past_performance myHorses[MAX_HORSES];
  152.  
  153. return 0;
  154. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
Standard output is empty