#include
using namespace std;
class date{
private:
int year;
int month;
int day;
public:
date(int myear,int mmonth,int mday){
year=myear;
month=mmonth;
day=mday;
}
void setyear(int myear){
year=myear;
}
int getyear(){
return year;
}
void deyear(){
cout<<year<<endl;
}
void setmonth(int mmonth){
month=mmonth;
}
int getmonth(){
return month;
}
void demonth(){
cout<<month<<endl;
}
void setday(int mday){
day=mday;
}
int getday(){
return day;
}
void deday(){
cout<<day<<endl;
}
};
class people{
private:
int card;
int phone;
string name;
int done;
date time;
bool result;
public:
void people(int card,int phone,string name,int done,date time,bool result){
}
void setcard(int mcard){
card=mcard;
}
int getcard(){
return card;
}
void decard(){
cout<<card<<endl;
}
void setphone(int mphone){
phone=mphone;
}
int getphone(){
return phone;
}
void dephone(){
cout<<phone<<endl;
}
void setname(int mname){
name=mname;
}
string getname(){
return name;
}
void deneme(){
cout<<name<<endl;
}
void setdone(int mdone){
done=mdone;
}
int getdone(){
return done;
}
void dedone(){
cout<<done<<endl;
}
void settime(date mtime){
time=mtime;
}
date gettime(){
return time;
}
void detime(){
cout<<time<<endl;
}
void setresult(int mresult){
result=mresult;
}
bool getresult(){
return result;
}
void deresult(){
cout<<result<<endl;
}
};
int main(){
return 0;
}
#include <iostream> //头文件别漏了哦
using namespace std;
class date {
private:
int year;
int month;
int day;
public:
//添加一个默认构造函数
date() {
year = 2022;
month = 01;
day = 01;
}
date(int myear, int mmonth, int mday) {
year = myear;
month = mmonth;
day = mday;
}
void setyear(int myear) {
year = myear;
}
int getyear() {
return year;
}
void deyear() {
cout << year << endl;
}
void setmonth(int mmonth) {
month = mmonth;
}
int getmonth() {
return month;
}
void demonth() {
cout << month << endl;
}
void setday(int mday) {
day = mday;
}
int getday() {
return day;
}
void deday() {
cout << day << endl;
}
//定义一个show函数来输出信息
void show() {
cout << this->year << "." << this->month << "." << this->day << endl;
}
};
class people {
private:
int card;
int phone;
string name;
int done;
date time;
bool result;
public:
//构造方法不能有返回类型(void、int等)
people(int card, int phone, string name, int done, date time, bool result) {
this->card = card;
this->phone = phone;
this->name = name;
this->done = done;
this->time = time;
this->result = result;
}
void setcard(int mcard) {
card = mcard;
}
int getcard() {
return card;
}
void decard() {
cout << card << endl;
}
void setphone(int mphone) {
phone = mphone;
}
int getphone() {
return phone;
}
void dephone() {
cout << phone << endl;
}
void setname(int mname) {
name = mname;
}
string getname() {
return name;
}
void deneme() {
cout << name << endl;
}
void setdone(int mdone) {
done = mdone;
}
int getdone() {
return done;
}
void dedone() {
cout << done << endl;
}
void settime(date mtime) {
time = mtime;
}
date gettime() {
return time;
}
void detime() {
//改为用函数输出信息
time.show();
}
void setresult(int mresult) {
result = mresult;
}
bool getresult() {
return result;
}
void deresult() {
cout << result << endl;
}
};
int main() {
return 0;
}
改好了,解释写在注释里,有什么问题可以随时问我
int main(){
return 0;
}
main函数里面要构造类,调用相关函数才有输出哦