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