没问题,你应该是你划分的有问题,参考一下下面,我运行没问题:
======================================================
文件zgxxb.h
======================================================
#if!defined(zgxxb)
#define zgxxb
#include
using namespace std;
const int SIZE=10;
class worker
{private:
char num[8];
char name[10];
public:
void setname(char[]);
char*getname();
void setnum(char[]);
char*getnum();
virtual void display();
};
class workers:public worker
{
private:
int age;
char sex[6];
public:
void setage(int a);
void setsex(char s[]);
int getage();
char*getsex();
void display();
};
void printer(worker &);
#endif
======================================================
文件zgxxb.cpp
======================================================
#include"zgxxb.h"
void worker::setname(char s[])
char*worker::getname()
void worker::setnum(char n[])
char*worker::getnum()
void worker::display()
{cout<<"\t"<
void workers::setage(int a)
void workers::setsex(char s[])
int workers::getage()
char*workers::getsex()
void workers::display()
{cout<<"\t"<
void printer(worker &s)
======================================================
文件main.cpp
======================================================
#include"zgxxb.h"
void main()
{
workers wks[SIZE];
worker wk[SIZE];
int number(0);
char ch[10];
int age;
for(int i=0;i
cin.getline(ch,'\n');
if(ch[0]=='0')
{number=i;
break;
}
wks[i].setnum(ch);
cout<<"\t姓名:";
cin.getline(ch,'\n');
wks[i].setname(ch);
cout<<"\t性别:";
cin.getline(ch,'\n');
wks[i].setsex(ch);
cout<<"\t年龄:";
cin>>age;
wks[i].setage(age);
getchar();
}
for(i=0;i
cout<<"\n\t编号"<<"\t姓名"<<"\t性别"<<"\t年龄"<
cout<<"\n\t编号"<<"\t姓名"<
}
dhih
785
我有C#版
lnap
242
应用百度Hi联系
有时间可以解决你的问题
我们可以根据你的需求提供一份适用于学生水平的源代码
6 | ES:\\306F4C1EF7A87FE96A11DA075271A3CF
5 | 交易提醒:预付定金是陷阱
7 |
1 | 北京易软个人软件
5 | 全职软件开发团队
6 | 十年信誉铸成品质
1 | 速度专业积累效率
5 | 定制信息管理系统更有优惠