// Add supporting structures - expect many structure types
// here ...
#define TRACK_NAME_LEN 50
#define HORSE_NAME_LEN 50
#define PERSON_NAME_LEN 50
#define COLOR_LEN 20
#define TRACK_CODE_LEN 10
#define NOTES_LEN 128
#define MAX_PAST_RACES 20
// Stores a calendar date
struct date
{
int mouth;
int day;
int year;
};
// TODO - add other supporting structures that could be
// used as types for members of the two main structures below
// Stores the time a race is scheduled to start
struct time_of_day
{
int hour;
int minute;
};
// Indicates the type of track surface
enum track_surface
{
SURFACE_DIRT,
SURFACE_TURF,
SURFACE_SYNTHETIC,
SURFACE_UNKNOWN
};
// Indicates the condition of the track
enum track_condition
{
COND_FAST,
COND_GOOD,
COND_SLOPPY,
COND_MUDDY,
COND_FIRM,
COND_YIELDING,
COND_UNKNOWN
};
// Identifies the unit used for race distance
enum distance_unit
{
DIST_FURLONGS,
DIST_MILES
};
// Holds the actual distance value
union distance_value
{
float furlongs;
float miles;
};
// Combines distance unit and value
struct distance
{
enum distance_unit unit;
union distance_value value;
};
// Stores basic performance statistics
struct performance_stats
{
int starts;
int wins;
int places;
int shows;
float earnings;
};
// Stores owner information
struct owner_info
{
char name[PERSON_NAME_LEN];
};
// Stores trainer information and stats
struct trainer_info
{
char name[PERSON_NAME_LEN];
struct performance_stats stats;
};
// Stores jockey information and stats
struct jockey_info
{
char name[PERSON_NAME_LEN];
struct performance_stats stats;
};
// Stores information about one previous race for a horse
struct past_performance
{
struct date raceDate;
char trackCode[TRACK_CODE_LEN];
int raceNumber;
struct distance raceDistance;
enum track_surface surface;
enum track_condition condition;
int fieldSize;
int postPosition;
int finishPosition;
float lengthsBehind;
float finalOdds;
float finalTime;
char comment[NOTES_LEN];
};
// add a structure to store details on each race
struct race_details
{
struct date raceDate; // A - the date of the race
int raceNumber; // C - the specific race number identifier
char trackName[50]; // E - the name of the track where the race was held
// TODO - add other members
struct time_of_day postTime;
enum track_surface surface;
enum track_condition condition;
struct distance raceDistance;
float purse;
char raceType[30];
char raceNotes[NOTES_LEN];
};
// add a structure to store details on each horse
struct horse_details_and_past_performance
{
int programNumber; // 1 - the program number
char horseName[50]; // 8 - horse name
char horseGender; // 10 - gender of the horse
// TODO - add other members
int age;
char color[COLOR_LEN];
struct owner_info owner;
struct trainer_info trainer;
struct jockey_info jockey;
float todayWeightCarried;
struct performance_stats lifetimeStats;
struct performance_stats trackStats;
struct performance_stats surfaceStats;
int medicationFlags;
int equipmentFlags;
struct past_performance pastRaces[MAX_PAST_RACES];
int pastRaceCount;
};
int main()
{
// NOTE: You don't have to populate any of these!!!
struct race_details myRaces[10];
struct horse_details_and_past_performance myHorses[20];
// nothing else needs to be added to main
return 0;
}