#define _MAXTEAMS 10 #define _MAXGAMES 5 #define _MONTHS 13 #define _DAYS 32 #include #include #include using namespace std; typedef ifstream team_schedules[_MAXTEAMS]; struct date{ int m;int d; int y;}; struct game{date d; // string h; // string v;}; int h; int v;}; typedef game schedule[_MONTHS][_DAYS][_MAXGAMES]; typedef int sch_count[_MONTHS][_DAYS]; //***************Prototypes************************ bool isleap(date d); int doy(date d); int datediff(date a, date b); string date2str(date d); date str2date(string s); date nextdate(date o); void open_files(ifstream&, team_schedules, int&, string[]); // inifile files team_count team_abbr void print_sch(schedule, sch_count,ofstream& of); // s s_c void load_ini(int&, int&, int&, ifstream&, int&); // team_count gamesperteam leaguemax inifile MAX_GM void clr_s_c(sch_count s_c); void chk_s_c(const sch_count); // s_c void clr_sch(schedule); // s void load_sch(int, team_schedules, sch_count, int ,int, string[],schedule); // leaguemax files s_c MAX_GM team_count abbr s //***************Prototypes************************ int main() { ifstream inifile; ofstream of; of.open("10teams.out"); schedule s; sch_count s_c; int team_count,leaguemax, MAX_GM, gamesperteam; team_schedules files; string team_abbr[_MAXTEAMS]; load_ini(team_count,gamesperteam,leaguemax,inifile,MAX_GM); open_files(inifile,files,team_count,team_abbr); clr_sch(s); clr_s_c(s_c); chk_s_c(s_c); load_sch(leaguemax,files,s_c,MAX_GM,team_count,team_abbr,s); chk_s_c(s_c); print_sch(s,s_c,of); return 0; } void load_ini(int &team_count,int &gamesperteam,int &leaguemax, ifstream& inifile,int& MAX_GM) { inifile.open("games.ini"); if (!inifile) { cout<<"File error"<>team_count; inifile.ignore(100,'\n'); inifile>>gamesperteam;inifile.ignore(100,'\n'); leaguemax=gamesperteam*team_count; cout<<"Teams: "<>fname; if (!inifile) cout<<"ERROR!!"<=MAX_GM) { cout<<" FULL!"<>ch; } cout<<"Games Scheduled ="<>ch; return; } void print_sch(schedule s, sch_count s_c,ofstream& of) {int mon, day, gm; date zilch={0,0,0}; #define cout of for (mon=_MONTHS/2;mon<_MONTHS;mon++) { cout<<"Mon="<