class Ccc
{
public:
char name[100];
int startTime;
int endTime;
cc() //constructor
{//null out everything
name[0]='\0';
startTime=-1;
endTime=-1;
}
int makeTime(int hr,int min){return hr*60+min;}
};
class Cschd
{
public:
Ccc cc[10];//I sure hope nobody has more than 9 classes in a day
int makeClass(char *name,int start_hr,int start_min,int end_hr,int end_min)
{
int num=0;//the array for which class of the day (0~9)
while (cc[num].name[0]='\0'){num++;}
int len=0;
while (name[len]!='\0'){cc[num].name=name[num];}//cc[num].name=name;
cc[num].startTime=cc[num].makeTime(start_hr,start_min);
cc[num].startTime=cc[num].makeTime(end_hr,end_min);
return num;//returns the id of the class instance
}
};
#define SATURDAY 0
#define MONDAY 1
#define TUESDAY 2
#define WEDNESDAY 3
#define THURSDAY 4
#define FRIDAY 5
#define SUNDAY 6
Cschd schd[7];//the schedule for every day
schd[MONDAY].makeClass("MA241",8,15,9,15);
//etc...
No comments:
Post a Comment