#include <iostream.h>
#include <string.h>
class time
{
private:
int hour,min,sec;
public:
time(int h,int m,int s)
{hour=h;min=m,sec=s;}
void fun()
{cout<<"时间是"<<hour<<":"<<min<<":"<<sec;
if (hour>12)
cout<<"pm"<<endl;
else
cout<<"am"<<endl;
}
};
#include < iostream.h >
#include < string.h >
class date
{private:
int year,month,day;
public:
date(int y,int M,int d)
{year=y;month=M;day=d;}
void fun()
{cout<<year<<"年"<<month<<"月"<<day<<"日"<<endl;
if((year%4==0)&&(year%100!=0)||(year%400==0))
cout<<"此年是闰年"<<endl;
else
cout<<"此年不是闰年"<<endl;
if(month>12)cout<<"输入时间错误"<<endl;}
};
#include <iostream.h>
#include <string.h>
#include "date.h"
#include "time.h"
class datetime:public date,public time
{public:
datetime(int y,int M,int d,int h,int m,int s):date( y, M, d),time( h, m, s)
{}
void fun()
{
date::fun();
time::fun();
}
};
#include "date.h"
#include "datetime.h"
#include "time.h"
#include <iostream.h>
#include <string.h>
void main()
{
datetime A(2017,7,27,11,20,23);
A.fun();
}
这个有错误怎么改fatal error C1083: Cannot open include file: 'date.h': No such file or directory