ImageVerifierCode 换一换
格式:DOCX , 页数:30 ,大小:24.21KB ,
资源ID:7733745      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7733745.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(vc学生信息管理系统.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

vc学生信息管理系统.docx

1、vc学生信息管理系统vc学生信息管理系统悬赏分:0 - 解决时间:2008-6-11 16:46 1)能够从屏幕上读取一个学生的信息并将信息存入到数据文件中。2)能够将指定的信息从文件中删除。3)能够按编号、姓名对学生的信息进行检索并将检索结果显示在屏幕上。4)可以统计全部学生的总成绩,及其在班上的排名。5)能够统计各科的平均成绩及及格率。6)要求有错误提示功能,例如性别只能输入男女,输入错误提示重新输入。7)如果检索不到相应的信息应提示用户。 #include #include #include #include #include #include #include #include #in

2、clude /#define NULL 0 int const Q=20; #define LEN sizeof(struct student) using namespace std; int n=0; /定义一个全局变量统计学生人数 /-定义一个学生考试信息的结构体 struct student char nameQ; /用来存放姓名的 char sexQ; /用来存放性别的 long int id; /用来存放准考证号的 int score4; /用来存放分数的 int total; /用来存放总分数的 struct student *next; ; /student向量容器 vecto

3、r stu; /-学生类 class Information public: Information() ; /构造函数. Information() ; /析构函数. student *creat();/建立链表函数。 void output(student *head); int count(student *head);/定义函数count()统计考生总数 student *insert(student*head);/指针函数*insert()用来添加考生信息. student *cancel(student *head,long int num);/指针函数*cancel()用来删除考

4、生信息. student *find(student *head,long int num); /指针函数*find()用来查找考生信息. void inorder(student *head);/定义inorder()函数将考生的总分从大到小排列并输出 void average( student *head);/求学生成绩的平均分的函数 void save(student *head);/保存函数 student *Read();/读取函数 private: student *p1,*p2,*p3,*head,st; ; Information:Information() cout *n;

5、cout -n; cout *nn; Information:Information() cout *n; cout -n; cout *n; student *Information:creat(void) /定义一个指向struct student的结构体指针函数*creat()用来增加考生信息. char chQ;n=0; /用来存放姓名的 p1=p2=(student *)malloc(LEN);/调用malloc()函数用来开辟一个新的存储单元 cout -endl; coutch; head=NULL; /给指针head赋初值 while (strcmp(ch,!)!=0) /调用

6、字符比较函数strcmp()用来判断是否继续输入 char str10; int flag=0; p1=(student *)malloc(LEN);/调用malloc()函数用来开辟一个新的存储单元 strcpy(p1-name,ch); /将循环结构前面输入的姓名复制到结构体名为p1的数组name中 coutp1-sex; coutstr; if(atol(str)99999999 | atol(str)1) coutid=atol(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(str)100 | atoi(str)1) cou

7、tscore0=atoi(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(str)100 | atoi(str)1) coutscore1=atoi(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(str)100 | atoi(str)1) coutscore2=atoi(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(str)100 | atoi(str)1) coutscore3=atoi(str); flag=

8、1; while(flag=0); flag=0; p1-total=p1-score0+p1-score1+p1-score2+p1-score3;/计算总分 if(n=0)head=p1;/如果是输入第一组学生考试信息就将指针p1赋给指针head else p2-next=p1;/否则将p1赋给p2所指结构体的next指针 p2=p1;/将指针p1赋给指针p2 n+; /将n的值加1 coutch;/将输入的姓名存放到字符数组ch中 p2-next=NULL;/将p2所指结构体的next指针重新赋空值 return (head);/将输入的第一组学生考试信息返回 /-定义output()函

9、数将考生的信息从头指针所指内容开始输出 void Information:output(student *head) if(head=NULL) cout 这是一个空表,请先输入考生成绩.n; else cout-n; cout *学生考试成绩信息表*n; cout-n; cout准考证号 姓 名 性别 计算机组成原理 概率统计 英语 C+ 平均分 总分n; cout-n; p1=head;/将头指针赋给p do coutsetw(8)id setw(9)name setw(8)sex setw(13)score0 setw(16)score1 setw(10)score2 setw(9)sc

10、ore3 setw(6)total/4.0 setw(11)totalendl; coutnext;/将下一组考生信息的next指针赋给p while(p1!=NULL);/若指针p非空则继续,目的是把所有的考生信息都传给指针p然后输出. /-统计学生人数的函数 int Information:count(struct student *head)/定义函数count()统计考生总数 if(head=NULL) return(0);/若指针head为空返回值为0 else return(1+count(head-next);/函数的递归调用 /-插入学生的成绩的函数 student *Info

11、rmation:insert( student *head) /插入新结点定义一个指向struct student的结构体指针函数*insert()用来添加考生信息. char str10; int flag=0; coutt-nendl; p1=(student *)malloc(LEN); /使p1指向插入的新结点 coutp1-name; /将输入的姓名存放到结构体名为p1的数组name中 coutp1-sex; coutstr; if(atol(str)99999999 | atol(str)1) coutid=atol(str); flag=1; while(flag=0); fla

12、g=0; coutstr; if(atoi(str)100 | atoi(str)1) coutscore0=atoi(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(str)100 | atoi(str)1) coutscore1=atoi(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(str)100 | atoi(str)1) coutscore2=atoi(str); flag=1; while(flag=0); flag=0; coutstr; if(atoi(st

13、r)100 | atoi(str)1) coutscore3=atoi(str); flag=1; while(flag=0); flag=0; p1-total=p1-score0+p1-score1+p1-score2+p1-score3;/计算总分 p2=head;/将头指针赋给p2 if(head=NULL) /若没调用次函数以前的头指针head为空 head=p1;p1-next=NULL; /则将p1赋给头指针head并将p1所指结构体成员指针next赋空值 else while(p1-idp2-id)&(p2-next!=NULL) p3=p2;/p3指向原p2指向的结点 p2=

14、p2-next; /p2后移一个结点 if(p1-idid) if(head=p2) p1-next=head; head=p1; /插入到第一个结点之前 else p3-next=p1; p1-next=p2; /插入到p3所指结点之后 else p2-next=p1; p1-next=NULL; /插入到尾结点之后 n+;/将学生人数加1 coutt你输入的学生信息已经成功插入删除函数 student *Information:cancel(student *head,long int num)/定义一个指向struct student的结构体指针函数*delete()用来删除考生信息.

15、if(head=NULL)/若调用次函数以前的头指针head为空 return(head); else p1=head;/否则将头指针赋给p1 while(num!=p1-id&p1-next!=NULL)/寻找要删除的结点当p1所指的学生准考证号不是输入的学生准考证号并且p1所指的next指针不为空 p2=p1; p1=p1-next; /p2指向原p1指向的结点p1后移一个结点 if(num=p1-id)/如果输入的学生准考证号是p1所指的学生准考证号/结点找到后删除 if(p1=head) head=p1-next;/如果head指针和p1指针相等则将下一个结点赋给指针head else

16、 p2-next=p1-next;/否则将p1所指结点赋给p2所指结点将要删除的学生信息跳过去 cout 删除准考证号为num查找函数 student *Information:find(student *head,long int num) /定义一个指向struct student的结构体指针函数*find()用来查找考生信息. if(head=NULL)/若调用次函数以前的头指针head为空 coutid&p1-next!=NULL) /寻找结点当p1所指的学生准考证号不是输入的学生准考证号并且p1所指的next指针不为空 p1=p1-next; /p2指向原p1指向的结点p1后移一个结

17、点 if(num=p1-id)/如果要查找的学生准考证号是p1所指的学生准考证号 cout-n; cout准考证号 姓名 性别 计算机组成原理 概率统计 英语 C+ 平均分 总分 n; cout-n; coutsetw(8)id setw(9)name setw(8)sex setw(13)score0 setw(16)score1 setw(10)score2 setw(9)score3 setw(6)total/4.0 setw(11)totalendl; cout-n; else cout 没找到准考证号为num的学生.n; /结点没找到 return(head); /-定义inorde

18、r()函数将考生的总分从大到小排列并输出 void Information:inorder(student *head) int i,k,m=0,j; student *pQ;/定义一个指向struct student的结构体指针数组p if(head!=NULL)/如果头指针是空则继续 m=count(head); cout-n; cout学生考试成绩统计表n; cout-n; cout准考证号 姓 名 性别 计算机组成原理 概率统计 英语 C+ 平均分 总分 名次n; cout-n; p1=head; for(k=0;knext; for(k=0;km-1;k+) /选择排序法 for(j=k+1;jtotaltotal) p2=pk; pk=pj; pj=p2; /从大到小排列的指针 for(i=0;im;i+) coutsetw(8)id setw(9)name setw(8)sex setw(13)score0 setw(16)score1 setw(10)score2 setw(9)score3 setw(6)total/4.0 setw(11)totalendl; cout求各科平均分成绩的函数 void Information:aver

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

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