该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
#include
class time
{
private:
int hour,minute,second;
public:
time(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}
void settime(int h,int m,int s);
void gettime(char *);
};
void time::settime(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}
void time::gettime(char *e)
{
char t[20];
_itoa(hour,e,10);
strcat(e,"/"); _itoa(minute,t,10);
strcat(e,t);
strcat(e,"/"); _itoa(second,t,10);
strcat(e,t);
}
class date
{
private:
int year,month,day;
public:
date(int y,int mo,int d)
{
year=y;
month=mo;
day=d;
}
void setdate(int y,int mo,int d);
void getdate(char *s);
};
void date::setdate (int y,int mo,int d)
{
year=y;
month=mo;
day=d;
}
void date::getdate(char *s)
{
char t[20];
_itoa(year,s,10);
strcat(s,"/"); _itoa(month,t,10);
strcat(s,t);
strcat(s,"/"); _itoa(day,t,10);
strcat(s,t);
}
class datetime:public date,public time
{
public:
datetime(int y,int mo,int s,int h,int m,int d):date(y,mo,d),time(h,m,s){}
void setdatetime();
void getdatetime(char *a,char *b);
};
void datetime::setdatetime()
{
void setdate(int y,int mo,int d);
void settime(int h,int m,int s);
}
void datetime::getdatetime(char* a,char* b)
{
void getdate(char *a);
void gettime(char *b);
}
void main()
{
char h[100],e[100];
datetime dt(1990,7,15,1,23,45);
dt.getdatetime(h,e);
cout<
cout<
}
此程序调试都没错,结果是这一连串的字,求各位高人多多指点。