帮忙啊:c++ 用链表实现一类

老改不出,不知问题在哪里,请大伙帮忙看看,谢谢拉 ,代码如下: #ifndef EMPLOYEE_H #define EMPLOYEE_H #include using namespace std; class Employee { protected: long number; string name; public: Employee() { number = 001; name = "null"; } Employee(long mnumber,string mname); void setNumber(long mnumber); void setName(string mname); long getNumber(); string getName(); void showEmployeeInfo(); }; #endif #include "Employee.h" #include #include #include using namespace std; Employee::Employee(long mnumber,string mname) { number = mnumber; name = mname; void Employee::setNumber(long mnumber) { number = mnumber; } void Employee::setName(string mname) { name =mname; } long Employee::getNumber() { return number; } string Employee::getName() { return name; } void Employee::showEmployeeInfo() { cout<<"编号为:"<next = NULL; } void EmployeeList::insert(Employee &emp) { LinkList p= new Node(); p->number = emp.getNumber(); p->name = emp.getName(); p->next = tou->next; tou->next = p; } void EmployeeList::showEmployeeList() { LinkList p; p = tou; while ((p->next)++ != NULL) p->showEmployeeInfo(); } //主函数 #include "EmployeeList.h" #include "Employee.h" #include #include #include #include using namespace std; int main(){ Employee zhang(001,'M',"fafa2121",21); Employee fa(002,'M',"zhuzhu",22); EmployeeList e1; e1.insert(zhang); //e1.insert(fa); e1.showEmployeeList(); return 0; }

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

帮忙啊:c++ 用链表实现一类

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭