简单版学生管理系统,c++,链表实现,如果你是计算机系的学生真的希望你不要完全复制,做下参考自己编写出来才能有所收获,这是对你的将来负责;
学生管理系统,主要划分为以下三个模块:
1) 学生:包括增加学生信息、删除学生信息、修改学生信息、查找学生信息、学生选课。
2) 课程:包括增加课程信息、删除课程信息、修改课程信息、查找课程信息。
3)拓展功能:文件导入,文件导出。
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
const int nubofCourse = 10;//学生最多可以选修的课程
typedef struct StudentMessage *sMessage;//学生结点指针类型
typedef struct Courses *sCourse;//课程结点指针类型
fstream foutint;//文件导入导出
/*课程结构体*/
struct Courses {
int stdCourstcount;
string cNo;
string cName;
string scTeacher;
string stdNo[nubofCourse];
sCourse cNext;
};
/*学生结构体*/
struct StudentMessage {
string sNo;//学号
string sClass;
string sName;
char sSex;
sMessage sNext;
};
typedef sMessage sm;//学生头指针类型
typedef sCourse sc;//课程头指针类型
/*关于我们,关于程序*/
void aboutMe() { //首页打印设置
string input;
cout << "\n\n\t\t\t*****************************\n";
cout << "\t\t\t 学生信息管理系统\n";
cout << "\t\t\t*****************************\n\n\n";
// cout<<"\n\t\t\t 欢迎来到学生信息管理系统\n\n";
cout << "--------------------------------------------------------------------------------\n";
cout << "\n\t\t\t拼搏到无能为力,\n"; cout << "\t\t\t\t 坚持到感动自己!\n";
cout << "\t 开发者:路ren甲\n\n"; cout << "\t 联系方式:QQ:1508287079 or Mail To:1508287079@qq.com\n";
cout << " \n--------------------------------------------------------------------------------\n";
//cout<<"\t______________________________________________________________________\n";
cout << "\t\t版权所有@路ren甲\n\n\n";
cout << "\t<输入任意字符进入>\n\t";
cin >> input; //让用户输入一个字符后再进行下一步
system("cls"); //清屏
}
//再见页面
void goodbye() { //首页打印设置
string input;
// cout<<"\n\t\t\t 欢迎来到学生信息管理系统\n\n";
cout << " \n\n\n\n\n\n\n\n--------------------------------------------------------------------------------\n";
cout << "\n\t\t可能程序还有许多不足,\n"; cout << "\t\t\t 希望大家可以提出或者修改!\n";
cout << "\t\t\t\t再见,遇见成功的自己!\n";
cout << " \n--------------------------------------------------------------------------------\n";
cout << "\t<输入任意字符关闭>\n\t";
cin >> input; //让用户输入一个字符后再进行下一步
exit(1); //清屏
}
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓课程函数↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓//
sc initC() {
sCourse chead;
chead = new Courses;
chead->cNext = NULL;
return chead;
}
//打印课程信息
int ptfselect_SCourse(sc head, string sId) {
int flags = 0;
if (head->cNext == NULL) { cout << "\n\t\t\t没有选到课喔……………!_!-_-\n"; return 1; }
cout << "\t\t课程编号" << "\t 课程名称" << "\t 开课老师" << endl;
//课程信息
head = head->cNext;
while (head != NULL) {
for (int l = 0; l < nubofCourse; l++) {
if (head->stdNo[l] == sId) {
flags = 1;
cout << "\t\t" << head->cNo << "\t\t" << head->cName << "\t\t" << head->scTeacher << "\t\n";
}
}
head = head->cNext;
}
if (flags == 0) { cout << "\n\t\t\t没有选到课喔……………!_!-_-\n"; }
cout << "\t\t----------------------------------------------------\n";
return 1;
}
int ptfSCourse(sc cHead) {
if (cHead->cNext == NULL) { cout << "没有课程信息\n"; return 0; }
//全部学生信息
cout << "\n\t\t课程编号" << "\t 课程名称" << "\t 开课老师" << endl;
cHead = cHead->cNext;
while (cHead != NULL) {
cout << "\t\t" << cHead->cNo << "\t\t" << cHead->cName << "\t\t" << cHead->scTeacher<< "\t\n";
cHead = cHead->cNext;
}
return 1;
}
void printfCourse(sc head, int i) {
//一个课程信息
int j;
sCourse find;
j = 0;
find = head->cNext;
cout << "\n\t\t课程编号" << "\t\t课程名称" << "\t\t开课老师" << endl;
while (find != NULL) {
j++; if (j == i) {
cout << "\t\t" << find->cNo << "\t\t" << find->cName << "\t\t" << find->scTeacher << "\t\n";
break;
}
find = find->cNext;
}
}
void pfCourse(sc head) {
cout << "\n\t\t课程编号" << "\t\t课程名称" << "\t\t开课老师" << endl;
cout << "\t\t" << head->cNo << "\t\t" << head->cName << "\t\t" << head->scTeacher << "\t\n";
cout << endl;
}
查找课程
int locateCourse(sc chead, string numb) {
int j = 0;
chead = chead->cNext;
while (chead != NULL) {
j++;//统计
if (numb == chead->cNo) {
return j;
}
chead = chead->cNext;
}
return 0;
}
添加课程
void addCourse(sc scHead) {
sc cnew;//新课程
int g = 0,k=0;
char flag = 'y';
while (flag == 'y') {
cnew = new Courses;
cnew->stdCourstcount = 0;
while (g==0) {
g = 1;
cout << "输入课程编号(六位数字):";
cin >> cnew->cNo;
if (locateCourse(scHead,cnew->cNo) != 0) { cout << "课程编号已经存在,
学生管理系统c++链表实现
最新推荐文章于 2024-08-12 00:13:37 发布
本文介绍了使用C++通过链表实现的学生管理系统,包括学生信息和课程信息的增删改查功能。系统分为学生模块、课程模块和拓展功能,涉及链表数据结构的操作。此外,还提供了文件导入导出、课程选课等功能,以及代码的详细注释,适合计算机专业学生学习参考。
摘要由CSDN通过智能技术生成