关于c++类的问题
#include<string>#include<iostream>
using namespace std;
class people{
public:
People(){
number=0;
sex=m;
}
void input();
void output();
private:
int number;
char sex;
Date birthday;
string name;
};
void People::input(int num,a,b,c,char se,string nam,Date birthday){
cout<<"请输入人员姓名:";
cin>>name;
cout<<"请输入人员性别:";
cin>>se;
cout<<"请输入人员编号:";
cin>>num;
cout<<"请输入录入人员时间:";
cin>>a>>b>>c;
number=num;
sex=se;
name=nam;
birthday.setDate(a,b,c);
}
void People::output(){
cout<<"姓名:"<<name<<"\n";
cout<<"性别:"<<sex<<"\n";
cout<<"编号:"<<number<<"\n";
cout<<"录入时间:"<<birthday.getYear<<"年"<<birthday.getMonth<<"月"<<birthday.getDay<<"日"<<endl;
}
class Date(){
public:
void setDate();
int getYear();
int getMonth();
int getDay();
private:
int year,month,day;
};
void Date::setDate(int a,int b,int c){
year=a;
month=b;
day=c;
}
int Date::getYear(){
return year;
}
int Date::getMonth(){
return month;
}
int Date::getDay(){
return day;
}
int main(){
People langpeople;
Date birthday;
langpeople.input(int num,a,b,c,char se,string nam,Date birthday);
langpeople.output();
return 0;
}