数据结构:学⽣档案管理系统(C++版)
课题描述:
1.为学⽣档案管理⼈员编写⼀个学⽣档案管理系统 ,⽤菜单选择⽅式完成下列功能:
2.学⽣档案信息添加:包括学号、姓名、性别、出⽣⽇期、学院、专业、班级、⾝份证号、政治⾯貌、籍贯、家庭住址、电话等。
3.学⽣档案信息查询:分别按学号、姓名、性别、学院、专业、班级、政治⾯貌、籍贯等进⾏查询。
4.学⽣档案信息的修改、删除:按姓名+学号进⾏学⽣档案信息的修改和删除。
系统简要分析:
1.学⽣档案管理系主要功能为:添加学⽣档案信息,如:学号,姓名,出⽣⽇期,学院,专业,班级,⾝份证号码,籍贯,家庭地址,电话等信息,并可以编辑学⽣档案信息,⽅便修改删减,还有按照⼀定要求排序学⽣档案。
2.本系统将创建⼀个学⽣档案管理系统的类,添加⼀些学⽣档案的属性和⾏为,进⾏学⽣档案信息的输⼊和输出。
3.该档案管理系统的修改和删除功能,分别可以由姓名和学号先进⾏查,然后输出要修改的学⽣信息,然后系统会提供相应的提⽰,让你选要修改的学⽣信息中具体的信息,如单独修改学号或专业信息等。本系统的插⼊和删除功能,都运⽤了单链表易于删除和查的功能特点。
4.系统具体操作功能如下,⾸先程序运⾏后,显⽰菜单功能列表。然后输⼊者根据菜单选项进⾏输⼊操作,可以添加⾃⼰的个⼈信息,修改信息,查询所要的信息。然后档案管理员可以在后期查所需学⽣信息,进⾏输出修改。
源代码:
#include<iostream>
#include <string>
using namespace std;
class Student
{
private:
string number;//学号
string name;//名字
string grade;//班级
string sex;//性别
int telephone;//⼿机号码
int identify;//⾝份证号码
string major;//专业
string political;//政治⾯貌
string address;//家庭地址
string nation;//籍贯
public:
Student* next;//next指向下⼀个学⽣,构成链表
Student() { next = NULL; }
Student(string n, string g, string num, string s, int tp, int i, string m, string p,string na,string a)
{
name = n;
grade = g;
number = num;
sex = s;
telephone = tp;
identify = i;
major = m;
political = p;
political = p;
nation = na;
address = a;
next = NULL;
};//构造函数
string getname() { return name; }//名字
string getgrade() { return grade; }//班别
string getnum() { return number; }//学号
string gets() { return sex; }//性别
int gettp() { return telephone; }//
int geti() { return identify; }//
string getm() { return major; }
string getp() { return political; }
string getna() { return nation; }
string geta() { return address; }
void setnum(string num) { number = num; }//修改学号
void setgrade(string g) { grade = g; }//修改班级
void setname(string n) { name = n; }//修改名字
void sets(string s) { sex = s; }//修改性别
void settp(int tp) { telephone = tp; }//修改⼿机号码
void seti(int i) { identify = i; }//修改⾝份证
void setm(string m) { major = m; }
void setp(string p) { political = p; }
void setna(string na) {nation = na;}
void seta(string a) { address = a; }
};
class Operation
{
private:
Student* head;
public:
Operation()
{
head = new Student;
}
void Menu();//菜单
void Insert();//插⼊
void Search();//查
void Remove();//修改
void Delete();//删除
void Print();//输出
};
void Operation::Menu()
{
cout << "*******************************************************************************************" << endl; cout << "------------------------- xxx⼤学学⽣档案管理系统 -------------------------" << endl; cout << "------------------------- *********************** -------------------------" << endl;
cout << "------------------------- 1.增加学⽣信息 -------------------------" << endl; cout << "------------------------- 2.显⽰学⽣信息 -------------------------" << endl; cout << "------------------------- 3.查学⽣信息 -------------------------" << endl; cout << "------------------------- 4.删除学⽣信息 -------------------------" << endl; cout << "------------------------- 5.修改学⽣信息 -------------------------" << endl; cout << "------------------------- 6.安全退出系统 -------------------------" << endl;
}
void Operation::Insert() //插⼊
{
string name;//名字
string grade;//班级
string number;//学号国庆去哪儿玩?
string number;//学号
string sex;//性别
int telephone;//⼿机号
int identify;//⾝份证号码
string major;
string political;
string nation;
string address;
Student* p = NULL;
cout << "请输⼊要添加学⽣的信息:" << endl;
cout << "请输⼊姓名:";
cin >> name;
cout << endl;
cout << "请输⼊班级:";
cin >> grade;
cout << endl;
cout << "请输⼊学号:";
cin >> number;
cout << endl;
cout << "请输⼊性别:";
cin >> sex;
cout << endl;
cout << "⼿机号码:";
cin >> telephone;
cout << endl;
cout << "⾝份证号码:";
cin >> identify;
cout << endl;
cout << "专业:";
cin >> major;
cout << endl;
cout << "政治⾯貌:";
cin >> political;
cout << endl;
cout << "籍贯:";
cin >> nation;
cout << endl;
cout << "家庭地址:";
cin >> address;
cout << endl;
Student* s = new Student(name, grade, number, sex, telephone, identify, major, political, nation, address); p = head;
while (p->next != NULL && p->getnum() < s->getnum())
{
p = p->next;
}
s->next = p->next;
p->next = s;
}
void Operation::Delete()//删除
{
string name;
Student* p = head->next, * q = head;
cout << "请输⼊要删除学⽣信息的姓名:" << endl;
cin >> name;
while (p != NULL)
{
if (p->getname() == name)
{
q->next = p->next;
delete p;
break;
}
p = p->next;
p = p->next;
q = q->next;
}
if (p != NULL)
{
cout << "删除成功!" << endl;
}
if (p == NULL)
{
cout << "\t\t没有到!" << endl;
}
}
void Operation::Search()//查询
{
Student* p = NULL;
cout << "\n** 查询学⽣信息 **\n" << endl;
cout << "请输⼊查询⽅式:" << endl;
cout << "1.按学号查询" << endl;
cout << "2.按姓名查询" << endl;
cout << "3.返回" << endl;
char c;
cin >> c;
switch (c)
{
case '1':
{string n;
cout << "请输⼊你要查询的学⽣的学号" << endl; cin >> n;
for (p = head; p != NULL; p = p->next)
{
if (p->getnum() == n)
{
cout
<< "姓名:" << p->getname() << endl
<< "班别:" << p->getgrade() << endl
<< "学号:" << p->getnum() << endl
<< "性别:" << p->getgrade() << endl
<< "电话号码:" << p->gettp() << endl
<< "⾝份证号码:" << p->geti() << endl
<< "专业:" << p->getm() << endl
<< "政治⾯貌:" << p->getp() << endl
<< "籍贯:" << p->getna() << endl
<< "家庭地址:" << p->geta() << endl;
}
}
break;
}
case '2':
{国家反诈app有多牛
string name;
cout << "请输⼊你要查询的学⽣姓名" << endl; cin >> name;
for (p = head; p != NULL; p = p->next)
{
if (name == p->getname())
{
cout
<< "姓名:" << p->getname() << endl
<< "班级:" << p->getgrade() << endl
<< "学号:" << p->getnum() << endl
<< "性别:" << p->gets() << endl
<< "⼿机号码:" << p->gettp() << endl
<< "⾝份证号码:" << p->geti() << endl
<< "专业:" << p->getm() << endl
<< "政治⾯貌:" << p->getp() << endl
<< "籍贯:" << p->getna() << endl
<< "家庭地址:" << p->geta() << endl;
}
}
break;
幽灵鲨}
case '3':
return;
}
}
void Operation::Print() //输出
{
Student* p;
cout
<< "姓名"
<< "\t班级"
<< "\t学号"
<< "\t性别"
<< "\t⼿机号码"
<< "\t⾝份证号码"
<< "\t专业"
<< "\t政治⾯貌"
<< "\t籍贯"
<< "\t地址" << endl;
for (p = head->next; p != NULL; p = p->next) cout
<< p->getname()
<< "\t" << p->getgrade()
<< "\t" << p->getnum()
<< "\t" << p->gets()
<< "\t" << p->gettp()
喜剧片电影<< "\t\t" << p->geti()
<< "\t\t" << p->getm()
<< "\t" << p->getp()
<< "\t\t" << p->getna()
<< "\t" << p->geta()
<< endl;
}
void Operation::Remove() //修改
{
string n;//修改项
string number;//学号
string grade;//班级
string name;//名字
string sex;//性别骑马与砍杀火与剑
int telephone;//⼿机号码
int identity;//⾝份证号码
int birth;//出⽣⽇期
string major;
国宝大熊猫作文三年级300字左右
string political;
string nation;
string address;
cout << "请输⼊你要修改的学⽣姓名" << endl; cin >> n;
Student* p;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论