c++学校人员信息管理系统
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1.C++课程设计题目:《学校人员信息管理系统》
用c++设计一个大学教师和学生管理程序,教师包括编号(a),姓名(c),职称(d)和教研室数据(b)的数据输入输出; 大学生包括编号(m),姓名( s),性别(t),班号(n),英语(e),高等数学(f)和数据结构(g)三门课程成绩输入输出和计算机平均分(ave);研究生包括编号,姓名,性别,班号,指导教师和研究方法数据输入输出; 博士后数据的输入输出;博士后既是教师也是研究生.(用派生,继承的方法可以做)
2.功能如下图所示:
3.部分代码
#include
#include
#include"persons.h"
#include"student.h"
#include"teacher.h"
#include"empoyee.h"
#include"chainList.h"
#include
void fileRead(chainList *list,ifstream &ff);//把文件从硬盘上读入内存
void fileWrite(chainList *list,ofstream &ff);//写入硬盘
int compareStr(char*str1,char*str2);//名字作为关键字,这个函数就用来比较
void addList(chainList *list);//同名的话,覆盖,或者改为新名字加入
void deleteNode(chainList *node);//根据名字删除
void editList(chainList *list,char *name);//要编辑的人名和新的资料
chainList *searchList(chainList *list,char*name);//只提供名字查询(其他以后加入)//返回前一个节点的指针
void orderList(chainList *list);//按名字排序
void orderListByAge(chainList *list);//按年龄降序排列
void orderListBySex(chainList *list);//按照性别排列,女士优先
void printStaticInfo(chainList*list);
void printList(chainList *list);
int main()
{cout<<"\tYou are welcome to the management system!"< cout<<"Do you want to load a file or setup a new list?Press l or s."< char sn; cin>>sn; char fileName[30]; chainList headNode(0,NULL); chainList *head=&headNode; if(sn=='l') {ifstream file; cout<<"File's name:"< cin>>fileName; file.open(fileName); if(! file)//为何输入不存在地文件后,机子变得很慢,而且没有结果出来? {cout<<"File not found!System exit."< return 1; } // cout<<"test"< fileRead(head,file);//读入文件到链表 file.close(); } printStaticInfo(head); char ctn; do {cout<<"main menu:"< cout<<"\t1.Add a person. 2.Delete a person 3.Edit a person"< cout<<"\t4.Search a person 5.Order the list 6.Print info about the list"< cout<<"\t0.exit"< cin>>ctn; switch(ctn) { case '0':break; case '1': addList(head); break; case '2': cout<<"Please input the person's name to be deleted:"< char nm[20]; cin>>nm; chainList *pdel; pdel=searchList(head,nm); char sure;//Make sure whether you want to delete the data sure='n'; if(!pdel->next) { cout<<"The person you input cann't be found"< } else{ cout<<"The persons infor follows:"< pdel->next->pl->print(); cout<<"Are you sure to delete it?Press y or n"< cin>>sure; if(sure=='y') { deleteNode(pdel); cout< } } break; case '3': cout<<"Please input the person's name:"< char nm1[20]; cin>>nm1; chainList *pp;