c语言作业,求帮助。 设计学生成绩管理程序(1)选项菜单集成各功能函数模块 105

设计学生成绩管理程序(1)选项菜单集成各功能函数模块(2)录入学生成绩(学号、计算机、高数、英语,总分自动计算),学号为4位整数(3)按学号查找某学生成绩(4)统计各课程... 设计学生成绩管理程序

(1)选项菜单集成各功能函数模块

(2)录入学生成绩(学号、计算机、高数、英语,总分自动计算),学号为4位整数

(3)按学号查找某学生成绩

(4)统计各课程的平均分、及格率、最高分、最低分

还能再追加财富值,本人初学者,求各位大神帮助,最好能编译截图出来。
要c++版的
展开
 我来答
匿名用户
2016-06-07
展开全部
头文件stumenu.h#ifndef _STUMENU_H#define _STUMENU_H#include "student.h"void main_menu(void);/*程序主界面*/void do_student(STUDENT *head,int num);/*功能模块*/int next_do(void);/*输入代码*/void exit_student(void);/*退出程序*/#endifstudent.h#ifndef _STUDENT_H#define _STUDENT_H#define MAX 1000typedef struct data{ char name[10]; char adress[100]; char phone[12]; int no; float chiness; float math; float english; float computer; float physic; float chemistry; float politic; float history; float all;}DATA;typedef struct student{ DATA data; int student_num; struct student *next;}STUDENT;#define MAL (STUDENT *)malloc(sizeof(STUDENT))STUDENT *init_student(void);/*初始化数据库,student_num=0,next指向NULL*/int is_student_full(STUDENT *head);/*检查数据库是否已满,满返回1否则返回0*/int is_student_empty(STUDENT *head);/*检查数据库是否为空,如为空返回1否则返回0*/DATA input_student_info(void);/*输入学生信息*/void insert_student_data(STUDENT *head);/*将data插入到学生信息数据库中*/int get_student_num(STUDENT *head);/*计算出当前数据库中学生的个数*/void get_student_info(STUDENT *head,char *name);/*查看name在数据库中的所有信息*/int save_student_info(STUDENT *head);/*将学生信息数据保存到文件中,如果成功返回1否则返回0*/int read_student_info(STUDENT *head);/*从文件中读学生信息,如果成功返回1,否则返回0*/void print_student_info(STUDENT *head);/*在屏幕中输出学生信息*/void delete_student_info(STUDENT *head,char *name);/*在数据库中删除name*/void delete_student_all_info(STUDENT *head);/*删除所有学生信息*/void re_student_info(STUDENT *head,char *name);/*修改name在数据库中的信息*/void sort_student_num(STUDENT *head);/*以总分排名次*/#endif实现代码stumenu.c#include "stdio.h"#include "stumenu.h"#include "student.h"#include "stdlib.h"void get_name(char *name);char name[10];void main_menu(void){ printf("\t********************欢迎使用学生管理系统********************\n"); printf("\t* 0.退出本程序 1.检查数据库是否为空 *\n"); printf("\t* 2.检查数据库是否已满 3.插入一个学生信息 *\n"); printf("\t* 4.输出当前学生个数 5.查看指定学生信息 *\n"); printf("\t* 6.保存学生信息到文件 7.加载学生信息 *\n"); printf("\t* 8.输出所有学生信息 9.删除指定学生信息 *\n"); printf("\t* 10.删除所有学生信息 11.修改指定学生信息 *\n"); printf("\t 12.按学生成绩总分排序 *\n"); printf("\t********************欢迎使用学生管理系统********************\n"); printf("输入前面的数字可进行操作:");}int next_do(void){ int num; scanf("%d",&num); while(num11) { printf("\n输入错误,请重新输入:"); scanf("%d",&num); } return num;}void do_student(STUDENT *head,int num){ switch(num) { case 1: if(is_student_empty(head)) printf("数据库为空!\n"); else printf("数据库不为空!\n"); break; case 2: if(is_student_full(head)) printf("数据库已满!\n"); else printf("数据库未满!\n"); break; case 3: insert_student_data(head); break; case 4: printf("当前学生个数为:%d\n",get_student_num(head)); break; case 5: get_name(name); get_student_info(head,name); break; case 6: save_student_info(head); break; case 7: read_student_info(head); break; case 8: print_student_info(head); break; case 9: get_name(name); delete_student_info(head,name); break; case 10: delete_student_all_info(head); break; case 11: get_name(name); re_student_info(head,name); break; case 12: sort_student_num(head); break; case 0: exit_student(); default: printf("输入错误,请重新输入!\n"); }}void exit_student(void){ printf("\t\t谢谢使用本程序,本程序由炕头哥亲情制作!\n"); printf("\t\t按回车键退出. . ."); while(getchar()!='\n') continue; getchar(); exit(0);}void get_name(char *name){ printf("请输入姓名:"); scanf("%s",name);}student.c#include "stdio.h"#include "student.h"#include "stdlib.h"#include "string.h"STUDENT *init_student(void){ STUDENT *head; if(head->next==NULL) return; head=MAL; head->student_num=0; head->next=NULL; printf("初始化完成!\n"); return head;}int is_student_full(STUDENT *head){ if(head->student_num>=MAX) return 1; else return 0;}int is_student_empty(STUDENT *head){ if(head->student_num==0) return 1; else return 0;}DATA input_student_info(void){ DATA data; printf("请输入学生姓名:"); scanf("%s",data.name); printf("\n请输入学号:"); scanf("%d",&data.no); printf("\n请输入地址:"); scanf("%s",data.adress); printf("\n请输入电话号码:"); scanf("%s",data.phone); printf("\n请输入语文成绩:"); scanf("%f",&data.chiness); printf("\n请输入数学成绩:"); scanf("%f",&data.math); printf("\n请输入英语成绩:"); scanf("%f",&data.english); printf("\n请输入物理成绩:"); scanf("%f",&data.physic); printf("\n请输入化学成绩:"); scanf("%f",&data.chemistry); printf("\n请输入政治成绩:"); scanf("%f",&data.politic); printf("\n请输入历史成绩:"); scanf("%f",&data.history); printf("\n请输入计算机成绩:"); scanf("%f",&data.computer); data.all=data.chiness+data.math+data.english+data.computer+data.physic+data.chemistry+data.politic+data.history; return data;}void insert_student_data(STUDENT *head){ if(is_student_full(head)) { printf("数据已满,不能再插入数据!\n"); return; } STUDENT *s,*r; float all; r=head; s=MAL; s->data=input_student_info(); while(r->next!=NULL) r=r->next; r->next=s; s->next=NULL; head->student_num++;}int get_student_num(STUDENT *head){ return head->student_num;}void get_student_info(STUDENT *head,char *name){ STUDENT *r; r=head; while(r->next!=NULL) if((strcmp(r->next->data.name,name))==0) { printf("\n姓名:%s\n学号:%d\n家庭住址:%s\n电话:%s\n语文:%.1f\n数学:%.1f\n英语:%.1f\n物理:%.1f\n化学:%.1f\n政治:%.1f\n历史:%.1f\n计算机:%.1f\n总分:%.1f\n",name,r->next->data.no,r->next->data.adress,r->next->data.phone,r->next->data.chiness,r->next->data.math,r->next->data.english,r->next->data.physic,r->next->data.chemistry,r->next->data.politic,r->next->data.history,r->next->data.computer,r->next->data.all); break; } else r=r->next; if(r->next==NULL) printf("没有找到%s!\n",name);}int save_student_info(STUDENT *head){ STUDENT *r; FILE *fp; if((fp=fopen("student_information.data","wb"))==NULL) return 0; for(r=head->next;r!=NULL;r=r->next) fwrite(r,sizeof(STUDENT),1,fp); fclose(fp); return 1;}int read_student_info(STUDENT *head){ FILE *fp; if((fp=fopen("student_information.data","rb"))==NULL) return 0; STUDENT *r,*s; r=head; s=MAL; fread(s,sizeof(STUDENT),1,fp); while(!feof(fp)) { r->next=s; r=s; head->student_num++; s=MAL; fread(s,sizeof(STUDENT),1,fp); } free(s); r->next=NULL; fclose(fp); return 1;}void print_student_info(STUDENT *head){ if(is_student_empty(head)) { printf("数据为空!\n"); return; } STUDENT *r; int i=0; r=head; while(r->next!=NULL) { printf("\n%d.姓名:%s\n学号:%d\n家庭住址:%s\n电话:%s\n语文:%.1f\n数学:%.1f\n英语:%.1f\n物理:%.1f\n化学:%.1f\n政治:%.1f\n历史:%.1f\n计算机:%.1f\n总分:%.1f\n",i,r->next->data.name,r->next->data.no,r->next->data.adress,r->next->data.phone,r->next->data.chiness,r->next->data.math,r->next->data.english,r->next->data.physic,r->next->data.chemistry,r->next->data.politic,r->next->data.history,r->next->data.computer,r->next->data.all); r=r->next; i++; printf("\n\n\n"); }}void delete_student_info(STUDENT *head,char *name){ STUDENT *r,*q; r=head; if(is_student_empty(head)) return; for(q=r->next;r!=NULL;r=q,q=q->next) if((strcmp(q->data.name,name))==0) { STUDENT *temp; temp=r->next; r->next=q->next; free(temp); head->student_num--; break; } if(r==NULL) printf("没有找到%s!\n",name);}void delete_student_all_info(STUDENT *head){ STUDENT *temp,*r; r=head->next; while(r!=NULL) { temp=r; r=r->next; free(temp); head->student_num--; }}void re_student_info(STUDENT *head,char *name){ STUDENT *r; r=head; while(r->next!=NULL&&(strcmp(r->next->data.name,name))!=0) r=r->next; if(r->next==NULL) { printf("没有找到%s!\n",name); return; } r->next->data=input_student_info();}void sort_student_num(STUDENT *head){ if(is_student_empty(head)) { printf("数据库为空!\n"); return; } STUDENT *temp,*q,*p; for(q=head;q->next!=NULL;q=q->next) for(p=q->next;p->next!=NULL;p=p->next) { if(p->next->data.all>q->next->data.all) if(q->next==p) { temp=p->next; p->next=p->next->next; temp->next=p; q->next=temp; p=temp; } else { temp=p->next; p->next=q->next; q->next=temp; temp=p->next->next; p->next->next=q->next->next; q->next->next=temp; } }}
追问
能截图下来吗,我看了好久还是没看懂
Victccmc
2016-06-08 · TA获得超过329个赞
知道小有建树答主
回答量:163
采纳率:0%
帮助的人:135万
展开全部

程序如下:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

typedef enum 
{
EN_COMPUTER,
EN_MATH,
EN_ENGLISH,
EN_BUTTON
};

typedef struct stStudentScore
{
int  stdId;
int scoreComputer;
int scoreMath;
int  scoreEnglish;
int scoreSum;
struct stStudentScore *pNext;
}ST_SC_INFO;

typedef struct stListInfo
{
ST_SC_INFO *pHead;
ST_SC_INFO *pCurr;
}ST_LIST_INFO;

ST_LIST_INFO gstList;
void LIST_Init(void)
{
gstList.pHead = (ST_SC_INFO *)calloc(1, sizeof(ST_SC_INFO));
if(gstList.pHead == NULL)
{
printf("calloc error\n");
exit(-1);
}
gstList.pHead->pNext = NULL;
//gstList.pCurr = gstList.pHead;
}

void LIST_NodeAdd(ST_SC_INFO nN)
{
ST_SC_INFO *pC = gstList.pHead;
ST_SC_INFO *pNewNode = NULL;
pNewNode = (ST_SC_INFO *)calloc(1, sizeof(ST_SC_INFO));
if(pNewNode == NULL)
{
printf("calloc error\n");
exit(-1);
}
memcpy(pNewNode, &nN, sizeof(ST_SC_INFO));
while(pC->pNext != NULL)
{
pC = pC->pNext;
}

pC->pNext = pNewNode;
pNewNode->pNext = NULL;
}

void LIST_NodeDel(int stdId)
{
ST_SC_INFO *pCurr = gstList.pHead;
ST_SC_INFO *pTmp = NULL;

while(pCurr->pNext != NULL)
{
if(pCurr->pNext->stdId == stdId)
{
pTmp = pCurr->pNext;
if(pCurr->pNext->pNext != NULL)
{
pCurr->pNext = pCurr->pNext->pNext;
}
else
{
pCurr->pNext = NULL;
}
free(pTmp);
pTmp = NULL;
}
else
{
pCurr = pCurr->pNext;
continue;
}
}

}

ST_SC_INFO * LIST_NodeFind(int stdId)
{
ST_SC_INFO *pCurr = gstList.pHead;
while(pCurr->pNext != NULL)
{
if(pCurr->pNext->stdId == stdId)
{
return pCurr->pNext;
}
else
{
pCurr = pCurr->pNext;
}
}
return NULL;
}

int STDSCORE_ScoreInpute(void)
{
ST_SC_INFO nN;
memset(&nN, 0x0, sizeof(ST_SC_INFO));

printf("Please Input student id:\n");
scanf("%d", &nN.stdId);

printf("Please Input Computer score:\n");
scanf("%d", &nN.scoreComputer);
nN.scoreSum += nN.scoreComputer;

printf("Please Input Math score:\n");
scanf("%d", &nN.scoreMath);
nN.scoreSum += nN.scoreMath;

printf("Please Input Englist score:\n");
scanf("%d", &nN.scoreEnglish);
nN.scoreSum += nN.scoreEnglish;

LIST_NodeAdd(nN);
printf("Score input finish\n\n");
return 0;

}

int STDSCORE_ScorePrint(void)
{
int stdId = 0;
ST_SC_INFO *ps = NULL;

printf("Please Input student id:\n");
scanf("%d", &stdId);

ps = LIST_NodeFind(stdId);
if(ps == NULL)
{
printf("Can't find %d student number, please check\n", stdId);
return 0;
}

printf("Student id:%d\n", ps->stdId);
printf("Computer score:%d\n", ps->scoreComputer);
printf("Math score:%d\n", ps->scoreMath);
printf("English score:%d\n", ps->scoreEnglish);
printf("Total score:%d\n\n", ps->scoreSum);

return 0;

}

int STDSCORE_ScoreCount(void)
{
int passNum[EN_BUTTON] = {0};
int hightScore[EN_BUTTON] = {0};
int LowScore[EN_BUTTON] = {100, 100, 100};
int sunScore[EN_BUTTON] = {0};
float flData;
int i;

int totalNum = 0;
ST_SC_INFO *pCurr = gstList.pHead;

if(pCurr->pNext == NULL)
{
printf("Please input student score first\n\n");
return 0;
}

while(pCurr->pNext != NULL)
{
totalNum++;
/*total score*/
sunScore[EN_COMPUTER] += pCurr->pNext->scoreComputer;
sunScore[EN_MATH] += pCurr->pNext->scoreMath;
sunScore[EN_ENGLISH] += pCurr->pNext->scoreEnglish;

/*Highest score*/
if(pCurr->pNext->scoreComputer > hightScore[EN_COMPUTER])
{
hightScore[EN_COMPUTER] = pCurr->pNext->scoreComputer;
}
if(pCurr->pNext->scoreMath > hightScore[EN_MATH])
{
hightScore[EN_MATH] = pCurr->pNext->scoreMath;
}
if(pCurr->pNext->scoreEnglish > hightScore[EN_ENGLISH])
{
hightScore[EN_ENGLISH] = pCurr->pNext->scoreEnglish;
}

/*Lowest score*/
if(pCurr->pNext->scoreComputer < LowScore[EN_COMPUTER])
{
LowScore[EN_COMPUTER] = pCurr->pNext->scoreComputer;
}
if(pCurr->pNext->scoreMath < LowScore[EN_MATH])
{
LowScore[EN_MATH] = pCurr->pNext->scoreMath;
}
if(pCurr->pNext->scoreEnglish < LowScore[EN_ENGLISH])
{
LowScore[EN_ENGLISH] = pCurr->pNext->scoreEnglish;
}

/*Pass precent*/
if(pCurr->pNext->scoreComputer > 60)
{
passNum[EN_COMPUTER]++;
}
if(pCurr->pNext->scoreMath > 60)
{
passNum[EN_MATH]++;
}
if(pCurr->pNext->scoreEnglish > 60)
{
passNum[EN_ENGLISH]++;
}
pCurr = pCurr->pNext;
}

for(i=0; i<EN_BUTTON; i++)
{
char className[12] = {0};
if(i==0)
strcpy(className, "Computer");
else if(i==1)
strcpy(className, "Math");
else if(i==2)
strcpy(className, "English");

flData = (float)sunScore[i]/(float)totalNum;
printf("%s avrage score: %f\n",className, flData);
flData = (float)passNum[i]/(float)totalNum;
printf("%s pass percent: %f\n",className, flData);
printf("%s Highest score: %d\n",className, hightScore[i]);
printf("%s Lowest score: %d\n",className, LowScore[i]);
}

printf("\n");
return 0;
}

int main()
{
int option;
LIST_Init();
printf("*******成绩管理系统******\n");
while(1)
{
printf("以下菜单项:\n");
printf("1 学生成绩录入\n");
printf("2 学生成绩查询\n");
printf("3 学生成绩统计\n\n");

printf("请输入你的选择:\n");

scanf("%d", &option);
if(option != 1 && option != 2 && option != 3)
{
printf("你输入的选项错误,请重新输入\n\n");
continue;
}

switch(option)
{
case 1:
STDSCORE_ScoreInpute();
break;
case 2:
STDSCORE_ScorePrint();
break;
case 3:
STDSCORE_ScoreCount();
break;
}
}
return 0;
}

Vc6++运行结果如下:

代码可以直接负责编译,无警告无错误,可以直接运行

以上,

追问
看不懂,好多都没教过
追答
额,这个都是比较基础的东西了,用的都是C语言库函数。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
西北战狼55
2016-06-07 · TA获得超过792个赞
知道小有建树答主
回答量:1023
采纳率:0%
帮助的人:250万
展开全部
这个我可以帮你写
追问
求程序
追答
看我头像
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2016-06-07
展开全部
下面这本书,后面一章有一个综合实训,看看就差不多了。
追问
什么书
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式