《2023年C++课程设计(教务管理系统).docx》由会员分享,可在线阅读,更多相关《2023年C++课程设计(教务管理系统).docx(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、2023年C+课程设计(教务管理系统) #include using namespace std; #include #include #include #include #include #include01.h cla University; void menu(University uni);/菜单函数声明 cla Student/学生类 public: string name; int age; string sex; int number; string major; public: void disp_stu(); friend void file_in(University &u
2、ni); friend void file_out(University uni); ; void Student:disp_stu() cla Institute/学院类 public: string name; cout head;/封装学生信息 public: void add_stu(); /添加学生 bool delete_stu(int i); / 删除学生 bool modefy_stu(int i); /修改学生信息 void disp_ins_1(); / 显示本院学生信息 friend void file_in(University &uni); friend void f
3、ile_out(University uni); ; void Institute:add_stu() Student *p=new Student; cout(*p).name; cout(*p).age; cout(*p).sex; cout(*p).number; cout(*p).major; head.Add(p);/在链表末尾增加一个节点 bool Institute:delete_stu(int i) head.Remove(i);/删除链表指定位置节点 return true; bool Institute:modefy_stu(int i) Student *p=new St
4、udent; cout(*p).name; cout(*p).age; cout(*p).sex; cout(*p).number; cout(*p).major; head.Remove(i);/删除链表指定位置节点 head.Insert(i,p);/在链表指定位置插入一个新节点 return true; void Institute:disp_ins_1() cla University/学校类 public: string name; int age; string addr; List head;/封装学院信息 public: void design_stu();/学生信息设置 in
5、t i; Node *q; q=head.pHead;/q指向学生节点双向链表头指针 cout coutpData-disp_stu(); q=q-pNext; void add_ins(); /添加学院 bool delete_ins(int n); / 删除学院 void design_cqut(); /设置学校信息 bool modefy_cqut(); /修改学校信息 void disp_cqut(); /显示学校信息 void design_ins(); /学院信息设置 bool modefy_ins(int n); /修改学院 void disp_ins(); /显示学院信息 vo
6、id search_menu(); void search_name(string n);/姓名 void search(string n);/性别/函数重载 void search(int n);/学号 bool search_age(int n);/年龄 friend void file_in(University &uni); ; friend void file_out(University uni); void University:design_stu() int i,m,j; int n; cout 学生信息设置 i;system(cls);/清屏 switch(i) case
7、1: disp_ins(); cout cout cinm;system(cls);/清屏 head.pCurrent=head.pHead;/当前指针指向双向链表头指针 for(j=1;j head.pCurrent=head.pCurrent-pNext;/当前指针指后移 coutpData-add_stu(); cout disp_ins(); cout cout cinm;system(cls);/清屏 head.pCurrent=head.pHead; /当前指针指向双向链表头指针 for(j=1;j head.pCurrent=head.pCurrent-pNext;/当前指针指后
8、移 head.pCurrent-pData-disp_ins_1(); coutn; head.pCurrent-pData-delete_stu(n); cout disp_ins(); cout cout cinm;system(cls);/清屏 head.pCurrent=head.pHead;/当前指针指向双向链表头指针 for(j=1;j head.pCurrent=head.pCurrent-pNext;/当前指针指后移 head.pCurrent-pData-disp_ins_1(); cout cinn; head.pCurrent-pData-modefy_stu(n); c
9、out void University:add_ins() bool University:delete_ins(int n) bool University:modefy_ins(int n) Institute *p=new Institute; cout(*p).name; head.Remove(n);/删除链表指定位置节点 head.Insert(n,p);/在指定位置插入节点信息 return true; head.Remove(n);/删除链表指定位置节点 return true; Institute *p=new Institute; cout(*p).name; head.A
10、dd(p);/在链表末尾增加一个节点 void University:disp_ins() int i; Node *q; q=head.pHead; /q指向学院节点双向链表头指针 for(i=1;i coutpData-namepData-head.size void University:design_ins() int i; int j; cout 学院信息设置 pNext; couti;system(cls);/清屏 switch(i) case 1: disp_ins(); cout disp_ins(); add_ins(); cout getch();system(cls);/
11、清屏 design_ins(); break; case 3: disp_ins(); coutj; delete_ins(j); cout disp_ins(); coutj; modefy_ins(j); cout case 5:menu(*this);break; bool University:modefy_cqut() coutname; coutage; coutaddr; return true; void University:design_cqut() int i; University uni; cout 学校信息设置 couti;system(cls);/清屏 switc
12、h(i) case 1: disp_cqut(); cout getch();system(cls);/清屏 design_cqut(); break; case 2: modefy_cqut(); cout getch();system(cls);/清屏 design_cqut(); break; case 3:menu(uni);break; void University:disp_cqut() cout void University:search_name(string n) int i,j,m=0; head.pCurrent=head.pHead;/当前指针指向学院节点头指针 f
13、or(i=0;ipData-head.pCurrent=head.pCurrent-pData-head.pHead;/当前指cout for(j=0;jpData-head.size;j+) if(n=head.pCurrent-pData-head.pCurrent-pData-name) head.pCurrent-pData-head.pCurrent-pData-disp_stu(); m+; head.pCurrent-pData-head.pCurrent=head.pCurrent-pData-head.pCurrent-pNext;/学生当前指针后移 bool Univers
14、ity:search_age(int n) int i,j,m=0; head.pCurrent=head.pHead; for(i=0;ipNext;/学院当前指针后移 cout head.pCurrent-pData-head.pCurrent=head.pCurrent-pData-head.pHead; for(j=0;jpData-head.size;j+) if(n=(head.pCurrent-pData-head.pCurrent-pData-age) head.pCurrent-pData-head.pCurrent-pData-disp_stu(); m+; head.pC
15、urrent-pData-head.pCurrent=head.pCurrent-pData-head.pCurrent-pNext; head.pCurrent=head.pCurrent-pNext; cout void University:search(string n) int i,j,m=0; head.pCurrent=head.pHead; for(i=0;ipData-head.pCurrent=head.pCurrent-pData-head.pHead; for(j=0;jpData-head.size;j+) if(n=head.pCurrent-pData-head.
16、pCurrent-pData-sex) head.pCurrent-pData-head.pCurrent-pData-disp_stu(); m+; head.pCurrent-pData-head.pCurrent=head.pCurrent-pData-head.pCurrent-pNext; coutpNext; void University:search(int n) int i,j,m=0; head.pCurrent=head.pHead; for(i=0;i head.pCurrent-pData-head.pCurrent=head.pCurrent-pData-head.
17、pHead; for(j=0;jpData-head.size;j+) if(n=head.pCurrent-pData-head.pCurrent-pData-number) head.pCurrent-pData-head.pCurrent-pData-disp_stu(); m+; head.pCurrent-pData-head.pCurrent=head.pCurrent-pData-head.pCurrent-pNext; head.pCurrent=head.pCurrent-pNext; cout /*信息查询菜*/ void University:search_menu()
18、int i; cout 信息查询显示i;system(cls);/清屏 switch(i) case 1: 单 disp_ins(); coutdesign_ins(); break; case 2: head.pCurrent=head.pHead;/当前指针指向学院节点头指针 for(i=0;i head.pCurrent-pData-disp_ins_1(); head.pCurrent=head.pCurrent-pNext; coutsearch_menu(); break; case 3: int j; disp_ins(); couti;system(cls);/清屏 head.
19、pCurrent=head.pHead; for(j=1;jpNext; head.pCurrent-pData-disp_ins_1(); coutsearch_menu(); break; case 4: string n; coutn;system(cls);/清屏 search_name(n); coutsearch_menu(); break; case 5: int n1; coutn1; search_age(n1); coutsearch_menu(); break; system(cls);/清屏 case 6: string n; coutn;system(cls);/清屏
20、 search(n); coutsearch_menu(); break; case 7: int n; coutn;system(cls);/清屏 search(n); coutsearch_menu(); break; case 8: menu(*this); break; /*/ int i,j; ifstream inf(cqutData.txt,ios:in); infuni.name; infuni.age; infuni.addr; infuni.head.size;/学院个数 for(i=0;ip-name; 导出文件数据void file_in(University &uni
21、) Node *m=new Node;/建立学院信息节点 m-pData=p;/把输入的学院信息节点赋给建立的学院信息节点 m-pNext=0; if(i=0) uni.head.pHead=m;/把节点m赋给学院信息节点 else uni.head.pEnd-pNext=m;/把节点m赋给下一个学院信息节点 m-pPrev=uni.head.pEnd;/节点m指向学院信息的尾节点 uni.head.pCurrent=uni.head.pEnd=m;/学院信息的尾节点始终指向m节点 infuni.head.pCurrent-pData-head.size;/学生个数 for(j=0;jpDat
22、a-head.size;j+) Student *q=new Student; infq-name; infq-age; infq-sex; infq-number; infq-major; Node *n=new Node; n-pData=q; n-pNext=0; if(j=0) uni.head.pCurrent-pData-head.pHead=n; else uni.head.pCurrent-pData-head.pEnd-pNext=n; n-pPrev=uni.head.pCurrent-pData-head.pEnd; uni.head.pCurrent-pData-hea
23、d.pCurrent=uni.head.pCurrent-pData-head.pEnd=n;/学生信息的尾节点始终指向n节点 /*/ void file_out(University uni) ofstream ouf(cqutData.txt,ios:out); int i,j; ouf 导入文件数据ouf uni.head.pCurrent=uni.head.pHead;/当前指针指向学院节点头指针 for(i=0;i oufpData-name oufpData-head.size uni.head.pCurrent-pData-head.pCurrent=uni.head.pCurr
24、ent-pData-head.pHead;/当前指针指向学生节点头指针 for(j=0;jpData-head.size;j+) oufpData-head.pCurrent-pData-namepData-head.pCurrent-pData-agepData-head.pCurrent-pData-sexpData-head.pCurrent-pData-numberpData-head.pCurrent-pData-major uni.head.pCurrent-pData-head.pCurrent=uni.head.pCurrent-pData-head.pCurrent-pNex
25、t;/学生当前指针后移 uni.head.pCurrent=uni.head.pCurrent-pNext;/学院当前指针后移 /*退出系统菜单*/ void exit(University uni) int i; couti; system(cls);/清屏 switch(i) case 1: file_out(uni); exit(0); break; case 2:exit(0);break; case 3: menu(uni); break; case 4: file_out(uni); menu(uni); break; /*/ void menu(University uni) s
26、ystem(cls);/*清屏*/ int i; cout 主菜单 cout cout cout couti;system(cls);/清屏 int main() University u; file_in(u); menu(u); return 0; switch(i) case 1:uni.design_cqut();break; case 2:uni.design_ins();break; case 3:uni.design_stu();break; case 4:uni.search_menu();break; case 5:exit(uni);break; C+课程设计(教务管理系统) C+课程设计 C+课程设计公司人事管理系统 C+课程设计学生信息管理系统 C+课程设计(简单图书管理系统) C语言课程设计报告教务管理系统 c+课程设计总结 C+课程设计学生成绩管理分析系统 C+课程设计电话簿管理 C+课程设计实训报告