#include<iostream>
using namespace std;
class Leapyear{
public:
void SetDate(int y,int m,int d){
year=y;
month = m;
day = d;
}
void IsLeapYear(){
if((year%4==0&&year%100!=0)||(year%400==0))
cout<<"1"<<endl;
else
cout<<"0"<<endl;
}
private:
int year,month,day;
};
int main(){
int a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
Leapyear date1;
Leapyear date2;
Leapyear* p;
*p=date2;
date1.SetDate(a,b,c);
date1.IsLeapYear();
p->SetDate(d,e,f);
p->IsLeapYear();
}
27、28行错误了。p指针都没分配空间,是不能进行赋值的
改成Leapyear *p = &date2;