这个程序错在哪里呢?请帮帮啦!
#include
#include
class Date{
short year;
short month;
short day;
public:
Date();
Date(int y,int m,int d):year(y),month(m),day(d){}
void show(){cout<};
class Staff{
char staffNo[5];
char name[10];
char sex;
Date birthDay;
public:
Staff();
Staff(const char st-no[],const char st-name[],char st-sex,
const Date &st-date):birthDay(st-date),sex(st-sex)
{
strncpy(staffNo,st-no,4);
strncpy(name,st-name,9);
}
void show()
{
cout< < < birthDay.show();
}
};
Date::Date()
{
cout< cin>>year>>month>>day;
cin.ignore(80,'\n');
}
Staff::Staff()
{
cout.setf(ios::left,ios::adjustfield);
cout< cin.getline(staffNo,5);
cin.ignore(80,'\n');
cout< cin.getline(name,10);
cin.ignore(80,'\n');
cout< cin>>sex;
cin.ignore(80,'\n');
}
void main(){
Staff ss[4];
for(int i=0;i<4;i++)ss[i].show();
}
--------------------next---------------------
阅读(1158) | 评论(0) | 转发(0) |