学生管理系统Word下载.docx

上传人:b****2 文档编号:794696 上传时间:2023-04-29 格式:DOCX 页数:33 大小:22.09KB
下载 相关 举报
学生管理系统Word下载.docx_第1页
第1页 / 共33页
学生管理系统Word下载.docx_第2页
第2页 / 共33页
学生管理系统Word下载.docx_第3页
第3页 / 共33页
学生管理系统Word下载.docx_第4页
第4页 / 共33页
学生管理系统Word下载.docx_第5页
第5页 / 共33页
学生管理系统Word下载.docx_第6页
第6页 / 共33页
学生管理系统Word下载.docx_第7页
第7页 / 共33页
学生管理系统Word下载.docx_第8页
第8页 / 共33页
学生管理系统Word下载.docx_第9页
第9页 / 共33页
学生管理系统Word下载.docx_第10页
第10页 / 共33页
学生管理系统Word下载.docx_第11页
第11页 / 共33页
学生管理系统Word下载.docx_第12页
第12页 / 共33页
学生管理系统Word下载.docx_第13页
第13页 / 共33页
学生管理系统Word下载.docx_第14页
第14页 / 共33页
学生管理系统Word下载.docx_第15页
第15页 / 共33页
学生管理系统Word下载.docx_第16页
第16页 / 共33页
学生管理系统Word下载.docx_第17页
第17页 / 共33页
学生管理系统Word下载.docx_第18页
第18页 / 共33页
学生管理系统Word下载.docx_第19页
第19页 / 共33页
学生管理系统Word下载.docx_第20页
第20页 / 共33页
亲,该文档总共33页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

学生管理系统Word下载.docx

《学生管理系统Word下载.docx》由会员分享,可在线阅读,更多相关《学生管理系统Word下载.docx(33页珍藏版)》请在冰点文库上搜索。

学生管理系统Word下载.docx

输入一个宿舍号码,可查出本室所有学生的基本信息并显示输出。

称号查询:

输入一个学号时,查出此学生所有课程情况,格式如下:

学号:

XX课程名称:

XXXX综合成绩:

XX实得学分:

XXX

...............................................................................

共修:

X科,实得总分为:

(3)删除功能:

当在A.TXT中删除一个学生时,自动地在B.TXT中删除此学生所有信息。

(4)排序功能:

能实现选择按综合成绩或实得学分升序或降序排序并显示数据。

[提示]

数据结构采用结构体数组,提供学生基本信息和学生成绩基本信息结构体数组。

二需求分析

根据题目要求,该程序应具备的功能有:

分为学生基本情况查询和成绩查询两种

#include"

stdafx.h"

#include<

fstream.>

iostream>

stdlib.h>

stdio.h>

string>

iomanip>

usingnamespacestd;

intcount=0;

/*-------学生基本信息输入函数--------*/

structstudent//定义结构体存储学生基本信息

{

charnumber[20];

charname[10];

charsex[20];

charsushe[20];

charphone[20];

structstudent*next;

};

structxuesheng{//定义结构体存储学生基本信息

charxuehao[20];

charkecheng_hao[20];

charkecheng_ming[20];

floatpingshi;

floatxuefen;

floatshiji_xuefen;

floatzonghe;

floatshiyan;

floatjuanmian;

structxuesheng*next;

/*-------学生成绩基本信息输入函数--------*/

xuesheng*creat_b()//.....................创建链表..........................//

intn=0;

xuesheng*p1,*p2;

structxuesheng*head;

charc='

Y'

;

head=NULL;

//设头指针为空

while(c=='

||c=='

y'

{

p1=newxuesheng;

//动态分配空间并建立动态链表

cout<

<

"

请输入学生信息"

endl;

cout<

请输入学号"

cin>

>

p1->

xuehao;

endl<

请输入课程编号:

kecheng_hao;

课程名称:

kecheng_ming;

学分:

xuefen;

平时成绩:

pingshi;

实验成绩:

shiyan;

卷面成绩:

juanmian;

n++;

if(n==1)

{

head=p1;

p2=p1;

}

else

p2->

next=p1;

if(p1->

shiyan==-1){p1->

zonghe=p1->

pingshi*3/10+p1->

juanmian*7/10;

}

else{p1->

pingshi*3/20+p1->

shiyan*3/20+p1->

zonghe>

90){p1->

shiji_xuefen=p1->

xuefen*1;

}else{

if(p1->

80){p1->

xuefen*8/10;

if(p1->

70){p1->

xuefen*3/4;

if(p1->

60){p1->

xuefen*3/5;

if(p1->

zonghe<

shiji_xuefen=0;

}}}}

getchar();

//吸收回车符getchar()是会接收任何输入流中的ASCII字符的,并不忽略空格换行等等这些控制字符。

\n是否继续录入学生信息Y/N"

c=getchar();

}

p2->

next=NULL;

return(head);

system("

cls"

);

/*-------存档函数--------*/

voidcundang_b(xuesheng*head)//存入文件b.txt

structxuesheng*p1;

fstreamoutfile("

b.txt"

ios:

:

out);

if(!

outfile)

不能打开目的文件"

exit(0);

outfile<

学号"

课程号"

课程名称"

学分"

平时成绩"

"

实验成绩"

卷面成绩"

综合成绩"

应得学分"

for(p1=head;

p1!

=NULL;

p1=p1->

next)

outfile<

xuehao<

setw(10)<

kecheng_hao<

kecheng_ming<

setw(6)<

xuefen<

setw(10)<

pingshi<

shiyan<

juanmian<

shiji_xuefen<

录入的学生信息已经保存在“b.txt”文件中\n"

outfile.close();

/*-----学生基本信息输入函数-----*/

student*creat_a()//.....................创建链表..........................//

student*p1,*p2;

structstudent*head;

p1=newstudent;

cin>

number;

\n请输入姓名:

name;

\n请输入性别:

\n"

sex;

\n请输入宿舍号:

sushe;

\n请输入电话号码:

phone;

getchar();

voidcundang_a(student*head)//存入文件a.txt

structstudent*p1;

a.txt"

姓名"

性别"

宿舍"

电话号码"

number<

name<

sex<

/*-----学生学号查询函数-----*/

voidsousuo_num(structstudent*head)//搜索学号

charnum[20];

structstudent*p;

for(;

system("

--学生基本信息查询--\n"

\n请输入要查询的学号:

\n若输入为0则返回上一级菜单"

if(strcmp(num,"

0"

)==0)//判断输入的姓名是否为0

return;

num;

p=head;

//将*p初始化

while(p!

=NULL)

if(strcmp(num,p->

number)==0)//找到指定学生所在节点

{

cout<

学号为"

p->

的学生信息如下:

姓名:

性别为:

宿舍:

sushe<

电话:

phone<

system("

pause"

break;

}

p=p->

next;

if(p==NULL)

cout<

查询不到此人,数据输入错误!

system("

/*-----学生姓名查询函数-----*/

voidsousuo_name(structstudent*head)//输出指定姓名的学生基本信息

{

charname[20];

\n请输入要查询的姓名:

if(strcmp(name,"

if(strcmp(name,p->

name)==0)//找到指定学生所在节点

姓名为"

性别:

/*-----学生宿舍查询函数-----*/

voidsousuo_sushe(structstudent*head)//输入宿舍号码进行查找

intflag;

structstudent*p=head;

//p指针的初始化

\n请输入要查询的宿舍:

if(strcmp(sushe,"

)==0)//判断输入的宿舍号是否为0

//

flag=0;

=NULL)//利用循环,输出指定宿舍的所有学生基本信息

if(strcmp(sushe,p->

sushe)==0)//找到指定学生所在节点

if(flag==0)

{

cout<

宿舍为"

%s的学生信息如下:

学号\t姓名\t性别\t电话\n"

flag=1;

}

\t"

}

if(flag==0)

宿舍号输入错误!

无此宿舍的信息"

/*-----学生基本信息查找-----*/

voidsousuo_student(structstudent*head)//参数:

学生基本信息链表头指针

intn;

if(head==NULL)

当前没有任何学生基本信息\n\n"

return;

1.按学号查询\n"

2.按姓名查询\n"

3.按宿舍查询\n"

\n请输入操作代码:

n;

switch(n)

case1:

sousuo_num(head);

break;

case2:

sousuo_name(head);

case3:

sousuo_sushe(head);

default:

输入指令错误!

if(n==0)

/*-----查找姓名函数-----*/

char*name(structstudent*head1,char*number)//参数:

学生基本信息链表头指针,要查找的学号

structstudent*p=head1;

while(p!

if(strcmp(number,p->

number)==0)

returnp->

//当学号匹配时,返回学生的姓名

p=p->

return"

无此人信息!

//找不到该学号的学生则返回“无”

}

/*-----学生成绩信息查找函数-----*/

voidsousuo_xuesheng(structstudent*head1,structxuesheng*head2)//利用两个结构体之间的联系,参数是两个结构体的头指针,查找指定学号的学生成绩信息

intflag,gongxiu;

floatsum;

structxuesheng*p;

if(head2==NULL)//判断学生成绩信息链表头指针是否为空

当前没有任何学生成绩信息\n\n"

学生成绩信息查询\n"

cin.getline(num,20);

p=head2;

gongxiu=0;

//共修科目

sum=0;

//实际学分

xuehao)==0)//找到指定学生所在节点

学号:

name(head1,num)<

课程编号:

课程名称:

综合成绩:

实得学分:

gongxiu++;

sum+=p->

shiji_xuefen;

//实得学分累加

没有这名学生的信息,信息不存在"

else

共修学科总数:

gongxiu<

所获得实际学分为:

sum<

/*-----查找函数菜单-----*/

voidsousuo(structstudent*head1,structxuesheng*head2)//总查询函数

1.学生基本信息查询\n"

2.学生成绩信息查询\n"

3.返回上一级菜单\n"

sousuo_student(head1);

sousuo_xuesheng(head1,head2);

操作有误!

if(n==3)

b

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

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2