fork download
  1. #include <stdio.h>
  2.  
  3. #define MAX_NAME_LEN 50
  4. #define MAX_TRACK_LEN 40
  5. #define MAX_RACES 10
  6. #define MAX_HORSES 20
  7. #define MAX_WORKOUTS 10
  8. #define MAX_PAST_RACES 10
  9.  
  10. typedef struct {
  11. int month;
  12. int day;
  13. int year;
  14. } Date;
  15.  
  16. typedef enum {
  17. SURFACE_DIRT,
  18. SURFACE_TURF,
  19. SURFACE_ALL_WEATHER
  20. } SurfaceType;
  21.  
  22. typedef enum {
  23. MARE, FILLY, COLT, BOY, GELDING, HORSE
  24. } HorseSex;
  25.  
  26. typedef union {
  27. float kg;
  28. int lbs;
  29. } HorseWeight;
  30.  
  31. typedef struct {
  32. char name[MAX_NAME_LEN];
  33. int wins;
  34. int places;
  35. int shows;
  36. float winPercent;
  37. } Trainer;
  38.  
  39. typedef struct {
  40. char name[MAX_NAME_LEN];
  41. int lifetimeStarts;
  42. int wins;
  43. int places;
  44. int shows;
  45. float winPercent;
  46. } Jockey;
  47.  
  48. struct customer;
  49.  
  50. typedef struct {
  51. Date workoutDate;
  52. float timeSeconds;
  53. char note[30];
  54. } Workout;
  55.  
  56. typedef enum {
  57. CLASS_MAIDEN,
  58. CLASS_CLAIMING,
  59. CLASS_ALLOWANCE,
  60. CLASS_STAKES
  61. } RaceClass;
  62.  
  63. typedef struct {
  64. char track[MAX_TRACK_LEN];
  65. SurfaceType surface;
  66. RaceClass raceClass;
  67. int positionFinish;
  68. char comments[80];
  69. } PastRace;
  70.  
  71.  
  72.  
  73. // TODO - add other supporting structures that could be used
  74. // as types for members of the two main structures below.
  75.  
  76. // add a structure to store details on each race
  77. struct customer {
  78. Date raceDate;
  79. float purse;
  80. int raceNumber; // C - the specific race number identifier
  81. char trackName[50]; // E - the name of the track where the race was held
  82. char raceConditions[100];
  83. int numberOfStarters;
  84. SurfaceType surface;
  85.  
  86. // TODO - add other members
  87. };
  88. // add a structure to store details on each horse
  89. typedef struct book{
  90. int programNumber;
  91. char horseName[MAX_NAME_LEN];
  92. HorseSex sex;
  93. char sire[MAX_NAME_LEN];
  94. char dam[MAX_NAME_LEN];
  95. HorseWeight weight;
  96. Trainer trainer;
  97. PastRace pastPerformances[MAX_PAST_RACES];
  98. Date birthDate;
  99. int pastRaceCount;
  100. float morningLineOdds;
  101. int postPosition;
  102. Jockey jockey;
  103. float lifetimeEarnings;
  104. Workout workouts[MAX_WORKOUTS];
  105. int workoutCount;
  106. } HorseDetailsAndPastPerformance; // TODO - add other members
  107.  
  108. int main ( ){
  109. // NOTE: You don't have to populate any of these!!!
  110. struct customer myRaces[10]; struct book myHorses[20];
  111. // nothing else needs to be added to main
  112. return (0);
  113. };
  114.  
Success #stdin #stdout 0.01s 5260KB
stdin
Standard input is empty
stdout
Standard output is empty