C++的问题,帮我调试一下下面这个程序

来源:百度知道 编辑:UC知道 时间:2024/05/09 14:20:14
#include"iostream"
#include"iomanip"
using namespace std;
//====================================
class Date{
int year,month,day;
pubilc:
bool leapyear();
void set(int y,int m,int d);
void print();
void add();
};
//====================================
bool Date::leapyear(){
return (year%4==0&&year%100=0)||(year%400==0);
}
void Date::set(int y,int m,int d){
cout<<'YEAR \n';
cin>>y;
cout<<'MONTH \n';
cin>>m;
cout<<'DAY \n';
cin>>d;
year=y; month=m; day=d;
}
void Date::print(){
cout<<setfill('0');
cout<<setw(2)<<day<<'日'<<setw(2)<<month<<'月'<<setw(4)<<year<<'年 \n'
cout<<setfill('');
}
void Date::add(){
int a;

#include"iostream"
#include"iomanip"
using namespace std;
//====================================
class Date{
int year,month,day;
public: // ★public 写成了pubilc
bool leapyear();
void set();
void print();
void add();
};
//====================================
bool Date::leapyear(){
return (year%4==0&&year%100!=0)||(year%400==0);// ★year%100=0 应该是year%100!=0
}
void Date::set(){
int y, m, d;
cout<<"YEAR \n"; // ★字符串用双引号括起
cin>>y;
cout<<"MONTH \n"; // ★
cin>>m;
cout<<"DAY \n"; // ★
cin>>d;
year=y; month=m; day=d;
}
void Date::print(){
cout.fill('0'); // ★cout<<setfill("0"); ?? 应该是cout.fill('0');
cout<<setw(2)<<day<<"日"<<setw(2)<<month<<"月"<<se