学生证信息管理系统.docx

上传人:b****5 文档编号:6345164 上传时间:2023-01-05 格式:DOCX 页数:24 大小:282.86KB
下载 相关 举报
学生证信息管理系统.docx_第1页
第1页 / 共24页
学生证信息管理系统.docx_第2页
第2页 / 共24页
学生证信息管理系统.docx_第3页
第3页 / 共24页
学生证信息管理系统.docx_第4页
第4页 / 共24页
学生证信息管理系统.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

学生证信息管理系统.docx

《学生证信息管理系统.docx》由会员分享,可在线阅读,更多相关《学生证信息管理系统.docx(24页珍藏版)》请在冰豆网上搜索。

学生证信息管理系统.docx

学生证信息管理系统

1系统的意义及其功能

本系统为《学生证管理程序》。

系统任务描述:

假设某校学生学生证基本信息主要包括:

学号、姓名、所在系、班级等,本系统应能对这些基本信息进行管理,并要求具有以下功能:

(1)通过键盘输入某位学生的学生证信息。

学生证包含的信息请参看自己的学生证;

(2)给定学号,显示某位学生的学生证信息;

(3)给定某个班级的班号,显示该班所有学生的学生证信息;

(4)给定某位学生的学号,修改该学生的学生证信息;

2系统的功能结构图以及调用关系

3系统功能详细分析

学生证管理系统需要完成的功能主要有:

从主函数进入各个子函数:

子函数包括学生证信息的键入、查询信息的功能、修改学生证信息的功能、退出系统。

具体功能如下:

3.1学生证信息的键入

3.2查询信息的功能

查询记录的主要功能是通过不同的查询方式查询学生的信息。

先是进入查询界面,再选择查询的方式,选择后将输出该学生的信息。

共分为两种:

给定某个学生的学号,显示该学生的学生证信息;

给定某个班级的班号,按学号排序来显示该班所有学生的学生证信息;

按班级排序来显示该班所有学生的学生证信息;

3.2.1输入学号,显示该生的学生证信息

3.2.2输入班号,显示该班所有学生的学生证信息

3.3修改学生证信息的功能

4运行界面

主菜单界面

 

学生证键入的界面

个人学生证信息显示界面

 

显示班级信息的选择输出方式的界面

按学号排序显示该班所有学生的学生证信息界面

按姓名排序显示该班所有学生的学生证信息界面

显示班级信息的退出界面

修改学生证信息的界面

5系统使用说明

1、进入程序时,先以菜单形式显示所有命令,然后用户通过菜单项选择操作;例如:

1学生证信息的键入

2输入学号,显示该生学生证信息

3输入班号,显示该班所有学生的学生证信息

4给定学号,修改该生学生证信息

5退出系统

请选择[1/2/3/4/5]:

2、键入学生证信息时,按照所给定的格式输入。

3、查询信息是按学生学号和班号的形式进行查询,填入学号后,则显示出该生所有信息;

选择按班号查询功能后,在选择显示输出方式,分两种:

一种按学号排序;另一种是按姓名排序。

选定后,再填入班号,则显示出该班所有学生的学生证信息(按已选定的排序方式显示)。

4、修改信息是按输入学号的形式进行修改,填入后,则显示出该生所有信息,然后询问是否修改,若回答“y”(大小写通用),则输入新值,否则不作修改。

6C语言源程序代码

#include

#include//用来使用清屏函数

#include

#include

#include

#defineLENsizeof(structSTUcard)

structSTUcard*creat();

voidviewperson();

voidviewclass();

voidnumber();

voidname();

voidchange();

structSTUcard*save();

structdate{

intyear;

intmonth;

intday;

};//定义用来嵌套的结构体

structSTUcard{

intnumber;

charname[20];

charsex[10];

chardepartment[20];

charclassnumber[10];

structdatetimeofenter;//嵌套结构体

charIDnumber[30];

structdatebirthday;

structSTUcard*next;

};//定义结构体

voidmain()

{

charc;

intn=0;

structSTUcard*head;

charbuild;//创建文件

FILE*fp;

fp=fopen("XX.out","rb");

if(fp==NULL)

{

printf("文件不存在,请创建(YorN)");

scanf("%c",&build);

if(build=='Y')

fp=fopen("XX.out","wb");

else

exit(0);

}

do

{

system("cls");//清屏

printf("*****************************************\n");

printf("1:

输入学生证信息\n");

printf("2:

查找个人信息\n");

printf("3:

查找班级里所有学生的学生证信息\n");

printf("4:

修改学生证信息\n");

printf("5:

退出\n");

printf("*****************************************\n");

printf("\n");

printf("请选择输入选项[1\\2\\3\\4\\5]:

>");

do

{

c=getchar();

}while(c!

='1'&&c!

='2'&&c!

='3'&&c!

='4'&&c!

='5');

getchar();

switch(c)

{

case'1':

head=creat();break;

case'2':

viewperson(head);break;

case'3':

viewclass(head);break;

case'4':

change(head);break;

case'5':

exit(0);break;

}

printf("按任意键返回主菜单:

\n");

flushall();

getchar();

printf("%d",n);

system("cls");

}while

(1);

}

intn;

structSTUcard*creat()//录入学生证信息函数

{

structSTUcard*head,*p1,*p2;

n=0;

head=NULL;

p1=p2=(structSTUcard*)malloc(LEN);

printf("请按以下格式输入学生证信息,注意每个数据之间间隔一个空格!

\n以学号为00000000结束录入,并且剩下的信息字符用“0”代替输入注意:

输入格式不变!

:

\n");

printf("学号姓名性别院系班级入学时间(年月日)身份证号出生日期(年月日)\n");

scanf("%d%s%s%s%s%d%d%d%s%d%d%d",&p1->number,p1->name,p1->sex,p1->department,p1->classnumber,

&p1->timeofenter.year,&p1->timeofenter.month,&p1->timeofenter.day,p1->IDnumber,

&p1->birthday.year,&p1->birthday.month,&p1->birthday.day);

while(p1->number!

=00000000)

{

n=n+1;

if(n==1)head=p1;

elsep2->next=p1;

p2=p1;

p1=(structSTUcard*)malloc(LEN);

scanf("%d%s%s%s%s%d%d%d%s%d%d%d",&p1->number,p1->name,p1->sex,p1->department,p1->classnumber,

&p1->timeofenter.year,&p1->timeofenter.month,&p1->timeofenter.day,p1->IDnumber,

&p1->birthday.year,&p1->birthday.month,&p1->birthday.day);

}

p2->next=NULL;

free(p1);

save(head);//保存文件

return(head);//把已录入信息的链表头指针返回给住函数

}

voidviewperson(structSTUcard*head)//查找个人信息函数

{

intm,a=0;

structSTUcard*p;

printf("请输入学号:

");

printf("\n");

scanf("%d",&m);

p=head;//获取头指针,以使用链表

while(p->next!

=NULL)//判断是否为空指针

{

if(p->number==m)

{

printf("学号:

%d\n姓名:

%s\n性别:

%s\n院系:

%s\n班级:

%s\n入学时间:

%d年%d月%d日\n身份证号:

%s\n出生日期:

%d年%d月%d日\n",

p->number,p->name,p->sex,p->department,p->classnumber,

p->timeofenter.year,p->timeofenter.month,p->timeofenter.day,p->IDnumber,

p->birthday.year,p->birthday.month,p->birthday.day);

printf("\n");

a=a+1;

}

p=p->next;//结点后移

}

if(p->number==m)

{

printf("学号:

%d\n姓名:

%s\n性别:

%s\n院系:

%s\n班级:

%s\n入学时间:

%d年%d月%d日\n身份证号:

%s\n出生日期:

%d年%d月%d日\n",

p->number,p->name,p->sex,p->department,p->classnumber,

p->timeofenter.year,p->timeofenter.month,p->timeofenter.day,p->IDnumber,

p->birthday.year,p->birthday.month,p->birthday.day);

printf("\n");

a=a+1;

}

printf("\n");

printf("共%d人\n",a);

if(a==0)printf("对不起,查无此人!

\n");

}

voidviewclass(structSTUcard*head)//查找班级信息函数

{

charc;

voidnumber();

voidname();

do

{

system("cls");//清屏

printf("****************************************\n");

printf("1:

按学号排序输出\n");

printf("2:

按姓名排序输出\n");

printf("3:

退出\n");

printf("****************************************\n");

printf("\n");

printf("请选择输入选项[1\\2\\3]:

>");

do

{

c=getchar();

}while(c!

='1'&&c!

='2'&&c!

='3');

getchar();

switch(c)

{

case'1':

number(head);break;

case'2':

name(head);break;

case'3':

exit(0);continue;

}

printf("按任意键返回上层菜单:

\n");

flushall();

getchar();

system("cls");

}while

(1);

}

voidnumber(structSTUcard*head)//按学号排序

{

charc[10];

inth1,a=0,i,j,k,w;

charhname[20];

charhsex[20];

charhdepartment[20];

charhclassnumber[10];

charhIDnumber[30];

structdatehtimeofenter;

structdatehbirthday;

structSTUcard*p,*p2,*p3;

p=head;

p2=head;

p3=p2->next;

for(k=1;;k++)//用来确定链表中共多少个结点

{

if(p->next!

=NULL)p=p->next;

elsebreak;

}

for(i=0;i

{

p2=head;

p3=p2->next;

for(j=0;j

{

if(p2->number>p3->number)

{

h1=p2->number;

strcpy(hname,p2->name);

strcpy(hsex,p2->sex);

strcpy(hdepartment,p2->department);

strcpy(hclassnumber,p2->classnumber);

strcpy(hIDnumber,p2->IDnumber);

htimeofenter=p2->timeofenter;

hbirthday=p2->birthday;

p2->number=p3->number;

strcpy(p2->name,p3->name);

strcpy(p2->sex,p3->sex);

strcpy(p2->department,p3->department);

strcpy(p2->classnumber,p3->classnumber);

strcpy(p2->IDnumber,p3->IDnumber);

p2->timeofenter=p3->timeofenter;

p2->birthday=p3->birthday;

p3->number=h1;

strcpy(p3->name,hname);

strcpy(p3->sex,hsex);

strcpy(p3->department,hdepartment);

strcpy(p3->classnumber,hclassnumber);

strcpy(p3->IDnumber,hIDnumber);

p3->timeofenter=htimeofenter;

p3->birthday=hbirthday;

}

p2=p3;

p3=p3->next;

}

}

printf("请输入班级:

\n");

scanf("%s",&c);

p=head;

for(w=1;w<=k;w++)

{

printf("\n");

if(strcmp(p->classnumber,c)==0)

{

printf("学号:

%d\n姓名:

%s\n性别:

%s\n院系:

%s\n班级:

%s\n入学时间:

%d年%d月%d日\n身份证号:

%s\n出生日期:

%d年%d月%d日\n",

p->number,p->name,p->sex,p->department,p->classnumber,

p->timeofenter.year,p->timeofenter.month,p->timeofenter.day,p->IDnumber,

p->birthday.year,p->birthday.month,p->birthday.day);

a=a+1;

}

p=p->next;

}

printf("\n");

printf("共%d人\n",a);

if(a==0)printf("对不起无此班级");

}

voidname(structSTUcard*head)//按姓名排序

{

charc[10];

inth1,a=0,i,j,k,w;

charhname[20];

charhsex[20];

charhdepartment[20];

charhclassnumber[10];

charhIDnumber[30];

structdatehtimeofenter;

structdatehbirthday;

structSTUcard*p,*p2,*p3;

p=head;

p2=head;

p3=p2->next;

for(k=1;;k++)

{

if(p->next!

=NULL)p=p->next;

elsebreak;

}

for(i=0;i

{

p2=head;

p3=p2->next;

for(j=0;j

{

if(strcmp(p2->name,p3->name)>0)

{

h1=p2->number;

strcpy(hname,p2->name);

strcpy(hsex,p2->sex);

strcpy(hdepartment,p2->department);

strcpy(hclassnumber,p2->classnumber);

strcpy(hIDnumber,p2->IDnumber);

htimeofenter=p2->timeofenter;

hbirthday=p2->birthday;

p2->number=p3->number;

strcpy(p2->name,p3->name);

strcpy(p2->sex,p3->sex);

strcpy(p2->department,p3->department);

strcpy(p2->classnumber,p3->classnumber);

strcpy(p2->IDnumber,p3->IDnumber);

p2->timeofenter=p3->timeofenter;

p2->birthday=p3->birthday;

p3->number=h1;

strcpy(p3->name,hname);

strcpy(p3->sex,hsex);

strcpy(p3->department,hdepartment);

strcpy(p3->classnumber,hclassnumber);

strcpy(p3->IDnumber,hIDnumber);

p3->timeofenter=htimeofenter;

p3->birthday=hbirthday;

}

p2=p3;

p3=p3->next;

}

}

printf("请输入班级:

\n");

scanf("%s",&c);

p=head;

for(w=1;w<=k;w++)

{

printf("\n");

if(strcmp(p->classnumber,c)==0)

{

printf("学号:

%d\n姓名:

%s\n性别:

%s\n院系:

%s\n班级:

%s\n入学时间:

%d年%d月%d日\n身份证号:

%s\n出生日期:

%d年%d月%d日\n",

p->number,p->name,p->sex,p->department,p->classnumber,

p->timeofenter.year,p->timeofenter.month,p->timeofenter.day,p->IDnumber,

p->birthday.year,p->birthday.month,p->birthday.day);

a=a+1;

}

p=p->next;

}

printf("\n");

printf("共%d人\n",a);

if(a==0)printf("对不起无此班级");

}

voidchange(structSTUcard*head)//修改信息

{intx;

structSTUcard*p1,*p2;

printf("输入要修改学生的学号\n");

scanf("%d",&x);

p1=head;

while((p1->number!

=x)&&(p1->next!

=NULL))

{

p2=p1;

p1=p1->next;

}

if(p1->number==x)

{

printf("请输入需要修改的信息:

\n");

printf("输入学号:

");

scanf("%d",&p1->number);

printf("输入姓名:

");

scanf("%s",p1->name);

printf("输入性别:

");

scanf("%s",p1->sex);

printf("输入院系:

");

scanf("%s",p1->department);

printf("输入班级:

");

scanf("%s",p1->classnumber);

printf("输入入学时间(年月日):

");

scanf("%d%d%d",&p1->timeofenter.year,&p1->timeofenter.month,&p1->timeofenter.day);

printf("输入身份证号:

");

scanf("%s",p1->IDnumber);

printf("输入出生日期(年月日):

");

scanf("%d%d%d",&p1->birthday.year,&p1->birthday.month,&p1->birthday.day);

printf("信息已修改");

save(head);

}

elseprintf("%d找不到该学号!

\n",x);

}

structSTUcard*save(stru

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1