数据结构课程设计(学生证管理程序)

【题目描述】
请设计一个学生证的管理程序,该程序应该具有下列功能:
(1) 通过键盘输入某位学生的学生证信息。学生证包含的信息请参看自己的学生证;
(2) 给定学号,显示某位学生的学生证信息(姓名,学号,学院,班级,专业,入学时间,学制性别);
(3) 给定某个班级的班号,显示该班所有学生的学生证信息;
(4) 给定某位学生的学号,修改该学生的学生证信息;
(5) 给定某位学生的学号,删除该学生的学生证信息;
(6) 提供一些统计各类信息的功能或排序功能。
【题目要求】
(1) 存储结构采用顺序表或链表;
(2) 用本学期所学算法实现各模块;
(3) 主函数设计一个菜单,通过菜单进入各模块测试。
要求用数据结构(c语言)

第1个回答  2014-12-12
晚上找时间给你写出来

/*【题目描述】
请设计一个学生证的管理程序,该程序应该具有下列功能:
(1) 通过键盘输入某位学生的学生证信息。学生证包含的信息请参看自己的学生证;
【题目要求】
(1) 存储结构采用顺序表或链表;
(2) 用本学期所学算法实现各模块;
(3) 主函数设计一个菜单,通过菜单进入各模块测试。
要求用数据结构(c语言)
*/
#include <iostream>
#include <string>
using namespace std;

struct student
{
int number;
string name;
int classno;
/* string sex;
其他字段不写了*/
student *next;
};

student * initclass()
{
student *head=NULL,*p;
int d;
do
{
cin>>d;
if(d==0) break;
p=new student;
p->number=d;
cin>>p->name>>p->classno;
p->next=NULL;
if(head==NULL)
head=p;
else
{
p->next=head;
head=p;
}
}
return head;
}

//(2) 给定学号,显示某位学生的学生证信息(姓名,学号,学院,班级,专业,入学时间,学制性别);
void findstudent(student *head,int d)
{
student *p;
p=head;
while(p!=NULL && p->number!=d)
p=p->next;
if(p==NULL)
{cout<<"没有这个学生"<<endl; exit(0);}
if(p->number==d)
cout<<p->number<<"\t"<<p->name<<"\t"<<p->classno<<endl;
}

//(3) 给定某个班级的班号,显示该班所有学生的学生证信息;
void showclass(student *head,int cno)
{
student *p=head;
bool flag=false;
while(p!=NULL)
{
if(p->classno==cno)
{ flag=true;
cout<<p->number<<"\t"<<p->name<<"\t"<<p->classno<<endl;
}
p=p->next;
}
if(!flag)
cout<<"没有这个班级的学生\n";
}

//(4) 给定某位学生的学号,修改该学生的学生证信息;
void modify(student *head,int d)
{
student *p=head;
while(p!=NULL && p->number!=d)
p=p->next;
if(p==NULL)
{
cout<<"没有这个学生"<<endl;
exit(0);
}
if(p->number==d)
{
cin>>p->name>>p->classno;
cout<<p->number<<"好学生信息更新完成"<<endl;
}

}

//(5) 给定某位学生的学号,删除该学生的学生证信息;

student *dropstudent(student *h,int d)
{
student *p,*q;
p=h;
while(p!=NULL && p->number!=d)
p=p->next;
if(p==NULL)
{
cout<<"没有这个学生"<<endl;
exit(0);
}
if(p->number==d)
{
if(p==h)
{
h=h->next;
delete p;
}
else
{
q=h;
while(q->next!=p)
q=q->next;
q->next=p->next;
delete p;
}
cout<<d<<"号学生信息删除成功"<<endl;
}
return h;
}
(6) 提供一些统计各类信息的功能或排序功能。
第2个回答  2014-12-11
学生证管理程序
按照你要求做。。