学生成绩管理实现功能1输入输出插入删除查找追加读-

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

学生成绩管理实现功能��1�输入、输出、插入、删除、查找、追加、读入、显示、保存��2�拷贝、排序、索引、分类合计、退出。1、用c语言编写一个简单的学生信息管理程序�能实现对学生信息的简单管理。2、具体要求�建立一个4个学生的信息登记表�每个学生的信息包括�学号�姓名�和3门课程的成绩�FOX,C,ENGLISH�。程序运行时显示一个简单的菜单�例如��1��信息输入�INPUT��2��总分统计学生成绩管理系统数据结构课程设计学生成绩管理实现功能��1�输入、输出、插入、删除、查找、追加、读入、显示、保存��2�拷贝、排序、索引、分类合计、退出。1、用c语言编写一个简单的学生信息管理程序�能实现对学生信息的简单管理。2、具体要求�建立一个4个学生的信息登记表�每个学生的信息包括�学号�姓名�和3门课程的成绩�FOX,C,ENGLISH�。程序运行时显示一个简单的菜单�例如��1��信息输入�INPUT��2��总分统计�COUNT��3��总分排序�SORT��4��查询(QUERY�其中��1��对4个学生的信息进行输入��2��对每个学生的3门课程统计总分�(3)�对4个学生的总分按降序排序并显示出来�(4)�查询输入一个学号后�显示出该学生的有关信息��includeiostream.h�includestdlib.hstructstudent{intnum;charname[20];intfoxscore;intcscore;intenglishscore;structstudent*next;};voidmenu(){coutwelecometomystudentgrademanagementsystemendl;coutpleasefolloweveryonestepinthemenuendl;cout1.inputinformationendl;cout2.totalscoresendl;cout3.sortendl;cout4.queryendl;cout***************************************************endl;}structstudent*creat(structstudent*head)//函数返回的是与节点相同类型的指针{structstudent*p1,*p2;p1=p2=(structstudent*)malloc(sizeof(structstudent));//申请新节点cinp1-nump1-namep1-foxscorep1-cscorep1-englishscore;//输入节点的值p1-next=NULL;//将新节点的指针置为空while(p1-num0){if(head==NULL)head=p1;//空表�接入表头elsep2-next=p1;//非空表�接到表尾p2=p1;p1=(structstudent*)malloc(sizeof(structstudent));//申请下一个新节点cinp1-nump1-namep1-foxscorep1-cscorep1-englishscore;//输入节点的值}returnhead;//返回链表的头指针}voidcount(structstudent*head){structstudent*temp;temp=head;//取得链表的头指针while(temp!==NULL){intm;m=temp-foxscore+temp-cscore+temp-englishscore;coutmendl;//输出链表节点的值temp=temp-next;//跟踪链表增长}}voidsort(structstudent*head){structstudent*tp;tp=head;inta[4];//定义总分数组inti,j,k;while(temp!==NULL){a[i]=tp-foxscore+tp-cscore+tp-englishscore;tp=tp-next;i=i+1;}for(j=1;j=3;j++)//冒泡法排序for(k=1;k=4-j;k++)if(a[k]a[k+1]){intt=a[k];a[k]=a[k+1];a[k+1]=t;}for(i=1;i5;i++)couta[i]endl;}voidquery(structstudent*head){structstudent*temper;temper=head;intnumber;cinnumber;for(inti=1;i=4;i++){if(number==temper-num){coutnameis:temper-nameendl;coutfoxscoreis:temper-foxscoreendl;coutcscoreis:temper-cscoreendl;coutEnglishscoreis:temper-englishscoreendl;coutcongratulation,syetemhavefoundwhatyouwanttosearchendl;}temper=temper-next;}}voidmain(){menu();coutfirstly,pleaseinputinformation:endl;structstudent*head;head=NULL;/*建一个空表*/head=creat(head);/*创建单链表*/coutsecondly,countthetotalscoreeachstudent:endl;count(head);coutthirdly,sortingthetotalscore:endl;sort(head);coutenternumthatyoucansearcheachshtudent'sinformationendl;query(head);coutthanksyouforusemystudentgrademanagementsystemendl;}编译时候都没有错....debug输入时候出现了错误....调试运行后发现原来是while循环出了问题啊修改后.........�includeiostream.h�includestdlib.hstructstudent{intnum;charname[20];intfoxscore;intcscore;intenglishscore;structstudent*next;};voidmenu(){coutwelecometomystudentgrademanagementsystemendl;coutpleasefolloweveryonestepinthemenuendl;cout1.inputinformationendl;cout2.totalscoresendl;cout3.sortendl;cout4.queryendl;cout***************************************************endl;}structstudent*creat(structstudent*head)//函数返回的是与节点相同类型的指针{structstudent*p1,*p2;p1=p2=(structstudent*)malloc(sizeof(structstudent));//申请新节点cinp1-nump1-namep1-foxscorep1-cscorep1-englishscore;//输入节点的值p1-next=NULL;//将新节点的指针置为空for(inti=1;i=4;i++){if(head==NULL)head=p1;//空表�接入表头elsep2-next=p1;//非空表�接到表尾p2=p1;p1=(structstudent*)malloc(sizeof(structstudent));//申请下一个新节点if(i=3){cinp1-nump1-namep1-foxscorep1-cscorep1-englishscore;}//输入节点的值}returnhead;//返回链表的头指针}voidcount(structstudent*head){structstudent*temp;temp=head;//取得链表的头指针for(inti=1;i=4;i++){intm;m=temp-foxscore+temp-cscore+temp-englishscore;coutmendl;//输出链表节点的值temp=temp-next;//跟踪链表增长}}voidsort(structstudent*head){structstudent*tp;tp=head;inta[4];//定义总分数组inti,j,k;a[1]=tp-foxscore+tp-cscore+tp-englishscore;tp=tp-next;a[2]=tp-foxscore+tp-cscore+tp-englishscore;tp=tp-next;a[3]=tp-foxscore+tp-cscore+tp-englishscore;tp=tp-next;a[4]=tp-foxscore+tp-cscore+tp-englishscore;for(j=1;j=3;j++)//冒泡法排序for(k=1;k=4-j;k++)if(a[k]a[k+1]){intt=a[k];a[k]=a[k+1];a[k+1]=t;}for(i=1;i5;i++)couta[i]endl;}voidquery(structstudent*head){structstudent*temper;temper=head;intnumber;cinnumber;for(inti=1;i=4;i++){if(number==temper-num){coutnameis:temper-nameendl;coutfoxscoreis:temper-foxscoreendl;coutcscoreis:temper-cscoreendl;coutEnglishscoreis:temper-englishscoreendl;coutcongratulation,syetemhavefoundwhatyouwanttosearchendl;}temper=temper-next;}}voidmain(){menu();coutfirstly,pleaseinputinformation:endl;structstudent*head;head=NULL;/*建一个空表*/head=creat(head);/*创建单链表*/coutsecondly,countthetotalscoreeachstudent:endl;count(head);coutthirdly,sortingthetotalscore:endl;sort(head);coutenternumthatyoucansearcheachshtudent'sinformationendl;query(head);coutthanksyouforusemystudentgrademanagementsystemendl;}可以在vc6.0上面编译通过......

1 / 21
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功