【C语言课程设计】学习小组成绩管理系统
本年度C语言课程设计的成果。原本老师所给题目为学生信息管理系统,后经过修改,最终根据高中学习的灵感,设计了一个适用于高中的学习小组成绩管理系统。系统不仅仅具有课程设计的链表添加删除等功能,还有一些学习小组特有的功能。
本课程设计有界面的排版,建议设置命令提示符窗口大小为120*30,获得最佳效果。
课程设计采用多文件处理,因此文件数量较多,文件长度较大。本课程设计制作周期为2周,有效代码共约1770行。今日开源发布与此。
文件1 main.c 主要功能:主函数
/*
* 文件名称:学习小组成绩管理系统
* 英文名称:Learning Group Performance Management System(LGPMS)
* 作 者: 几何司令
* 完成日期: 2017 年 9 月 8 日
* 版 本 号: V1.0
* Copyright (c) 2017,
* All rights reserved.
* 代码总行数约1770行
*/
/* 系统特色
*多文件编译,结构化编程,层次清晰
*蕴含学习小组特色
*系统界面清晰整洁便于操作
*采用链表方式,最大程度方便使用
*/
/* 主程序文件 */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "main.h"
struct student *he = NULL;
int nn=0;
char nam[200]="默认学习小组";
char zuz[20]="无";
int max=0;
int min=0;
int main()
{
welcome();
system("cls");
mainmenu();
}
文件2 add.c 功能:新建链表
#include"main.h"
struct student *add(struct student *head)
{
extern int max;
extern int min;
extern int nn;
struct student *p1,*p2,*p;
head=NULL;
int b,c;
int cc=0;
system("cls");
title();
if(nn!=0)
{
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf(" 新建学生信息将覆盖之前所有数据。如需添加数据,请选择追加数据。\n\n");
printf(" 是否继续?");
yonmenu();
scanf("%d",&b);
if(b!=1)
managemenu();
}
system("cls");
title();
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf(" 确定开始添加成绩与信息吗?");
yonmenu();
scanf("%d",&b);
if(b!=1)
managemenu();
else
{
p1= (struct student *) malloc (sizeof(struct student));
system("cls");
title();
nn=0;
nn=nn+1;
printf("\n\n\n\n 开始添加第%d个学生成绩信息。\n\n",nn);
printf("\n 请输入学生姓名:<_________>\b\b\b\b\b\b\b\b\b\b");
scanf("%s",&p1->name);
printf("\n 请输入学生学号:<_________>\b\b\b\b\b\b\b\b\b\b");
scanf("%s",&p1->number);
printf("\n 请输入语文成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[0]);
printf("\n 请输入数学成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[1]);
printf("\n 请输入英语成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[2]);
printf("\n 请输入文综/理综成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[3]);
p1->all=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];
p2=p1;
system("cls");
title();
printf("\n\n\n 数据添加成功!是否继续添加? ");
yonmenu();
scanf("%d",&p1->no);
while(p1->no==1)
{
nn=nn+1;
if(nn==2)
{
head=p1;
}
else
{
p2->next=p1;
}
p2=p1;
p1=(struct student *) malloc (sizeof(struct student));
system("cls");
title();
printf("\n\n\n\n 开始添加第%d个学生成绩信息。\n\n",nn);
printf("\n 请输入学生姓名:<_________>\b\b\b\b\b\b\b\b\b\b");
scanf("%s",&p1->name);
printf("\n 请输入学生学号:<_________>\b\b\b\b\b\b\b\b\b\b");
scanf("%s",&p1->number);
printf("\n 请输入语文成绩:<___>\b\b\b\b");
fflush(stdin);
scanf("%d",&p1->score[0]);
printf("\n 请输入数学成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[1]);
printf("\n 请输入英语成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[2]);
printf("\n 请输入文综/理综成绩:<___>\b\b\b\b");
scanf("%d",&p1->score[3]);
p1->all=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];
fflush(stdin);
system("cls");
title();
printf("\n\n\n 数据添加成功!是否继续添加? ");
yonmenu();
fflush(stdin);
scanf("%d",&p1->no);
}
if(nn==1)
{
head=p1;
}
else
{
p2->next=p1;
p2=p1;
p1=(struct student *) malloc (sizeof(struct student));
}
p2->next=NULL;
system("cls");
title();
printf("\n\n数据添加成功!全部数据如下:\n");
p=head;
if(head!=NULL)
{
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
do
{
cc=cc+1;
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",cc);
printf("║%-16s",p->name);
printf("║%-16s",p->number);
printf("║%-8d",p->score[0]);
printf("║%-8d",p->score[1]);
printf("║%-8d",p->score[2]);
printf("║%-8d",p->score[3]);
printf("║%-8d║\n",p->all);
p=p->next;
}
while(p!=NULL);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
}
extern int max,min;
max=max_c(head);
min=min_c(head);
system("pause");
return head;
}
}
文件3 add2.c 功能:追加学生信息
#include"main.h"
struct student *add2(struct student *head,struct student *p2)
{
extern int max;
extern int min;
extern int nn;
struct student *p1,*p3;
int b,c;
system("cls");
title();
if(head==NULL)
{
printf("\n\n\n\n\n 没有数据!无法追加!\n");
system("pause");
managemenu();
}
else{
printf(" \n\n\n 确定开始追加成绩与信息吗?");
yonmenu();
scanf("%d",&b);
if(b!=1)
managemenu();
else
{
if(p2==NULL)
{
do
{
nn=nn+1;
system("cls");
title();
printf("\n\n\n\n 开始添加第%d个学生成绩信息。\n\n",nn);
p2=(struct student *) malloc (sizeof(struct student));
printf("\n 请输入学生姓名:");
scanf("%s",&p2->name);
printf("\n 请输入学生学号:");
scanf("%s",&p2->number);
printf("\n 请输入语文成绩:");
scanf("%d",&p2->score[0]);
printf("\n 请输入数学成绩:");
scanf("%d",&p2->score[1]);
printf("\n 请输入英语成绩:");
scanf("%d",&p2->score[2]);
printf("\n 请输入文综/理综成绩:");
scanf("%d",&p2->score[3]);
p2->all=p2->score[0]+p2->score[1]+p2->score[2]+p2->score[3];
if(head==NULL)
{
head=p2;
head->next=NULL;
}
else
{
p1=p3=head;
while(p1->next!=NULL)
{
p3=p1;
p1=p1->next;
}
p1->next=p2;
p2->next=NULL;
}
system("cls");
title();
printf("\n\n\n 数据追加成功!是否继续添加? ");
yonmenu();
scanf("%d",&c);
}
while(c==1);
}
system("cls");
title();
printf("\n\n\n\n 数据追加成功!\n");
system("pause");
managemenu();
return head;
}
}
}
文件4 alter.c 功能:排序信息
#include "main.h"
struct student *alter(struct student *head)
{
char name2[20];
char xuehao[20];
int g,hh;
system("cls");
title();
if(head == NULL) //检查链表是否为空,若为空,则终止操作
{
printf("\n\n\n 链表为空,请输入\n");
system("pause");
managemenu();
}
else //否则,新建两空指针
{
struct student *n,*h;
h = NULL;
n = NULL;
system("cls");
title();
printf("\n\n");
printf(" 1、按照总分排序\n");
printf("\n");
printf("\n");
printf(" 2、按照语文分数排序\n");
printf("\n");
printf("\n");
printf(" 3、按照数学分数排序\n");
printf("\n");
printf("\n");
printf(" 4、按照英语分数排序\n");
printf("\n");
printf("\n");
printf(" 5、按照综合分数排序\n");
printf("\n\n");
printf(" 6、返回\n");
printf(" 请输入序号<1-6>:_____\b\b\b");
scanf("%d",&g);
switch(g)
{
case 1:
{
system("cls");
title();
altertitle();
scanf("%d",&hh);
fflush(stdin);
switch(hh)
{
case 1:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->all <= h->all) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
case 2:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->all >= h->all) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
default:
{
system("cls");
title();
printf("\n\n\n 选择错误,自动返回主菜单");
system("pause");
managemenu();
}
}
break;
}
case 2:
{
system("cls");
title();
altertitle();
scanf("%d",&hh);
switch(hh)
{
case 1:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[0] <= h->score[0]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
case 2:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[0]>= h->score[0]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
default:
{
system("cls");
title();
printf("\n\n\n 选择错误,自动返回主菜单");
system("pause");
managemenu();
}
}
break;
}
case 3:
{
system("cls");
title();
altertitle();
scanf("%d",&hh);
switch(hh)
{
case 1:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[1]<= h->score[1]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
case 2:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[1] >= h->score[1]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
//交换数据
break;
}
default:
{
system("cls");
title();
printf("\n\n\n 选择错误,自动返回主菜单");
system("pause");
managemenu();
}
}
break;
}
case 4:
{
system("cls");
title();
altertitle();
scanf("%d",&hh);
switch(hh)
{
case 1:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[2] <= h->score[2]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
case 2:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[2] >= h->score[2]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
default:
{
system("cls");
title();
printf("\n\n\n 选择错误,自动返回主菜单");
system("pause");
managemenu();
}
}
break;
}
case 5:
{
system("cls");
title();
altertitle();
scanf("%d",&hh);
switch(hh)
{
case 1:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[3] <= h->score[3]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
case 2:
{
for(h = head; h->next!=NULL; h=h->next) //h指针从head指针所在节点开始移动,直到指针域为空
{
for(n = h->next; n!=NULL; n=n->next) //n指针从head指针所在节点开始移动,直到指针域为空
{
if(n->score[3] >= h->score[3]) //若n节点的all值小于或等于h节点的
{
n->all = n->all + h->all;
h->all = n->all - h->all;
n->all = n->all - h->all;
n->score[0] = n->score[0] + h->score[0];
h->score[0] = n->score[0] - h->score[0] ;
n->score[0] = n->score[0] - h->score[0] ;
n->score[1] = n->score[1] + h->score[1];
h->score[1] = n->score[1] - h->score[1] ;
n->score[1] = n->score[1] - h->score[1] ;
n->score[2] = n->score[2] + h->score[2];
h->score[2] = n->score[2] - h->score[2] ;
n->score[2] = n->score[2] - h->score[2] ;
n->score[3] = n->score[3] + h->score[3];
h->score[3] = n->score[3] - h->score[3] ;
n->score[3] = n->score[3] - h->score[3] ;
strcpy(name2,n->name);
strcpy(n->name,h->name);
strcpy(h->name,name2);
strcpy(xuehao,n->number);
strcpy(n->number,h->number);
strcpy(h->number,xuehao);
//交换数据
}
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
break;
}
default:
{
system("cls");
title();
printf("\n\n\n 选择错误,自动返回主菜单");
system("pause");
managemenu();
}
}
break;
}
default:
{
system("cls");
title();
printf("\n\n\n 选择错误,自动返回主菜单");
system("pause");
managemenu();
}
}
system("cls");
title();
printf("\n\n\n 排序完成!!!\n");
system("pause");
return head;
}
}
文件5 alteritle.c 功能:输出选择排版格式
void altertitle()
{
printf("\n\n\n");
printf(" 1、由低到高\n");
printf("\n");
printf("\n");
printf(" 2、由高到低\n");
printf("\n");
printf("\n");
printf(" 请输入序号<1-2>:_____\b\b\b");
}
文件6 exitmenu.c 功能:退出菜单
void exitmenu()
{
int a;
title();
printf("\n\n\n\n");
printf(" 确定退出系统?");
yonmenu();
scanf("%d",&a);
if(a==1)
exit(0);
else
mainmenu();
}
文件7 groupsitting.c 功能:小组相关功能设置
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void groupsetting()
{
extern struct student *he ;
extern int nn;
extern char nam[200];
extern char zuz[20];
char nam2[200];
extern int max;
extern int min;
struct student *p1;
int a;
int b;
int f=1;
char bb[20];
title();
printf(" ════════════════════\n");
printf(" \n");
printf(" 小组名称:%s \n",nam);
printf(" \n");
printf(" ════════════════════\n");
printf(" \n");
printf(" 小组组长:%s \n",zuz);
printf(" \n");
printf(" ════════════════════\n");
printf(" 1、修改组名\n\n");
printf(" 2、修改组长\n\n");
printf(" 3、查看小组成绩\n\n");
printf(" 4、返回\n\n");
printf(" 请输入序号<1-4>:_____\b\b\b");
scanf("%d",&a);
switch(a)
{
case 1:
{
system("cls");
title();
printf("\n\n\n\n 确定修改小组名称吗?");
yonmenu();
scanf("%d",&b);
if(b!=1) // printf("laji");
{
groupsetting();
}
else
{
system("cls");
title();
printf("\n\n\n\n 输入新组名:");
scanf("%s",&nam2);
strcpy(nam,nam2);
system("cls");
title();
printf("\n\n\n\n 设置成功!\n");
system("pause");
groupsetting();
}
}
case 2:
{
if(he==NULL)
{
system("cls");
title();
printf("\n\n\n\n 没有组员成绩数据!无法添加组长。");
system("pause");
groupsetting();
}
else
{
system("cls");
title();
show(he);
printf("请输入新组长学号\n");
scanf("%s",bb);
p1 = he;
while(strcmp(p1->number,bb)!=0)
{
if (p1->next == NULL) break;
p1 = p1->next;
}
if (strcmp(p1->number,bb)==0)
{
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
strcpy(zuz,p1->name);
printf(" 已经将本名学生设置为组长!\n");
system("pause");
groupsetting();
}
}
}
case 3:
{
system("cls");
title();
show(he);
printf(" 按任意键返回\n");
groupsetting();
}
case 4:
{
mainmenu();
}
default:
{
system("pause");
groupsetting();
}
}
}
文件8 idelete.c 功能:删除
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void groupsetting()
{
extern struct student *he ;
extern int nn;
extern char nam[200];
extern char zuz[20];
char nam2[200];
extern int max;
extern int min;
struct student *p1;
int a;
int b;
int f=1;
char bb[20];
title();
printf(" ════════════════════\n");
printf(" \n");
printf(" 小组名称:%s \n",nam);
printf(" \n");
printf(" ════════════════════\n");
printf(" \n");
printf(" 小组组长:%s \n",zuz);
printf(" \n");
printf(" ════════════════════\n");
printf(" 1、修改组名\n\n");
printf(" 2、修改组长\n\n");
printf(" 3、查看小组成绩\n\n");
printf(" 4、返回\n\n");
printf(" 请输入序号<1-4>:_____\b\b\b");
scanf("%d",&a);
switch(a)
{
case 1:
{
system("cls");
title();
printf("\n\n\n\n 确定修改小组名称吗?");
yonmenu();
scanf("%d",&b);
if(b!=1) // printf("laji");
{
groupsetting();
}
else
{
system("cls");
title();
printf("\n\n\n\n 输入新组名:");
scanf("%s",&nam2);
strcpy(nam,nam2);
system("cls");
title();
printf("\n\n\n\n 设置成功!\n");
system("pause");
groupsetting();
}
}
case 2:
{
if(he==NULL)
{
system("cls");
title();
printf("\n\n\n\n 没有组员成绩数据!无法添加组长。");
system("pause");
groupsetting();
}
else
{
system("cls");
title();
show(he);
printf("请输入新组长学号\n");
scanf("%s",bb);
p1 = he;
while(strcmp(p1->number,bb)!=0)
{
if (p1->next == NULL) break;
p1 = p1->next;
}
if (strcmp(p1->number,bb)==0)
{
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
strcpy(zuz,p1->name);
printf(" 已经将本名学生设置为组长!\n");
system("pause");
groupsetting();
}
}
}
case 3:
{
system("cls");
title();
show(he);
printf(" 按任意键返回\n");
groupsetting();
}
case 4:
{
mainmenu();
}
default:
{
system("pause");
groupsetting();
}
}
}
文件9 import.c 功能:录入文件
#include "main.h"
struct student *import()
{
int a=0;
system("cls");
title();
struct student *p1,*p2;
struct student *head =(struct student *)malloc(sizeof(struct student));
char t[20],filename[20],n[20];
int y,s,w,z;
struct student *p;
struct student *q;
p=q=head;
p1 = p2 = head;
printf("请输入要录入的文件名(包括后缀名):");
scanf("%s",&filename);
FILE * r= fopen(filename,"r");
if(r==NULL)
{
printf("打开文件失败!");
return NULL;
}
while(fscanf(r,"%s %s %d %d %d %d",&t,&n,&y,&s,&w,&z)!=EOF)
{
q=(struct student *)malloc(sizeof(struct student));
strcpy(p->name,t);
strcpy(p->number,n);
p->score[0]=y;
p->score[1]=s;
p->score[2]=w;
p->score[3]=z;
p->all=y+s+w+z;
p->next=q;
p=q;
}
p->next=NULL;
while(p1->next != NULL)
{
p2 =p1;
p1= p1->next;
}
p2->next = NULL;
return head;
}
void importsuccess()
{
system("cls");
title();
printf("导入成功");
system("pause");
managemenu();
}
文件10 information.c 功能:系统说明
void information()
{
title();
printf(" ╔═══════╦═════════════════════════════════════════════╗\n");
printf(" ║ 软件说明 ║ 学习小组成绩管理系统(Learning Group Performance Management System)是一款可以有效║\n");
printf(" ║ ║ 进行学习小组内部成员成绩信息管理的小型软件。软件使用人可以利用这款软件轻松对学习小组成员║\n");
printf(" ║ ║ 考试信息进行管理,查看,可以方便对学习小组信息进行编辑修改,可以快速分析学习小组成员的整║\n");
printf(" ║ ║ 体成绩。软件主要适用于高中大型考试之后小组成员成绩的登记和小组的整体成绩分析。 ║\n");
printf(" ║ ║ ║\n");
printf(" ╠═══════╬═════════════════════════════════════════════╣\n");
printf(" ║ 使用提示 ║ ║\n");
printf(" ║ ║ *请把窗口大小调整为120*30以获得最佳界面效果。 ║\n");
printf(" ║ ║ ║\n");
printf(" ║ ║ *请按照输入提示输入相应内容以正确使用本软件。 ║\n");
printf(" ║ ║ ║\n");
printf(" ╠═══════╬═════════════════════════════════════════════╣\n");
printf(" ║ 使用说明 ║ ║\n");
printf(" ║ ║ #按照提示对软件进行操作即可。 ║\n");
printf(" ║ ║ ║\n");
printf(" ╠═══════╬═════════════════════════════════════════════╣\n");
printf(" ║ ║ * 中文名称:学习小组成绩管理系统 ║\n");
printf(" ║ ║ * 英文名称:Learning Group Performance Management System(LGPMS) ║\n");
printf(" ║ 软件开发信息 ║ * 作 者: 东北林业大学 信息与计算机工程学院软件工程2016级 张峻巍 ║\n");
printf(" ║ ║ * V1.0 Copyright (c) 2017 All rights reserved. ║\n");
printf(" ╚═══════╩═════════════════════════════════════════════╝\n");
printf(" 按任意键返回主菜单…… ");
system("pause");
mainmenu();
}
文件11 mainmenu.c 功能:主菜单
void mainmenu()
{
char numm='0';
title();
printf("\n\n\n");
printf(" 1、学习小组信息\n");
printf("\n");
printf("\n");
printf(" 2、成员成绩管理\n");
printf("\n");
printf("\n");
printf(" 3、软件使用说明\n");
printf("\n");
printf("\n");
printf(" 4、退出管理系统\n");
printf("\n");
printf("\n");
printf(" 请输入序号<1-4>:_____\b\b\b");
scanf("%s",&numm);
switch(numm)
{
case '1':
{
groupsetting();
break;
}
case '2':
{
managemenu();
break;
}
case '3':
{
information();
break;
}
case '4':
{
exitmenu();
break;
}
default :
{
printf("\n \n ");
system("pause");
system("cls");
mainmenu();
break;
}
}
}
文件12 manage.c 功能:成绩管理子菜单
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void managemenu()
{
extern struct student *he ;
extern int nn;
title();
char a='0';
int c;
printf("\n\n\n");
printf(" 1、新建小组成员成绩信息 5、追加小组成员成绩信息\n");
printf("\n");
printf("\n");
printf(" 2、修改小组成员成绩信息 6、删除小组成员成绩信息\n");
printf("\n");
printf("\n");
printf(" 3、显示所有成员成绩信息 7、排序小组成员成绩信息\n");
printf("\n");
printf("\n");
printf(" 4、查询小组成员成绩信息 8、保存小组成员信息到文件\n");
printf("\n");
printf("\n");
printf(" 9.从文件导入 \n");
printf("\n");
printf("\n");
printf(" 0、返回主菜单ok\n");
printf("\n");
printf("\n");
printf(" 请输入序号<1-9>:_____\b\b\b");
scanf("%s",&a);
switch(a)
{
case '1':
{
he=add(he);
managemenu();
break;
}
case '2':
{
he=revise(he);
managemenu();
break;
}
case '3':
{
show(he);
managemenu();
break;
}
case '4':
{
search(he);
break;
}
case '6':
{
showfile(he);
he=idelete(he);
managemenu();
break;
}
case '7':
{
he=alter(he);
managemenu();
break;
}
case '8':
{
output(he);
break;
}
case '5':
{
he=add2(he,NULL);
break;
}
case '9':
{
he=import();
showfile(he);
managemenu();
break;
}
case '0':
{
mainmenu();
break;
}
default :
{
printf("\n \n ");
system("pause");
system("cls");
managemenus();
break;
}
}
}
文件13 managemenu.c 功能:文件管理菜单
#include "main.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void managemenus()
{
extern struct student *he ;
extern int nn;
title();
char a='0';
int c;
printf("\n\n\n");
printf(" 1、新建小组成员成绩信息 5、追加小组成员成绩信息\n");
printf("\n");
printf("\n");
printf(" 2、修改小组成员成绩信息 6、删除小组成员成绩信息\n");
printf("\n");
printf("\n");
printf(" 3、显示所有成员成绩信息 7、排序小组成员成绩信息\n");
printf("\n");
printf("\n");
printf(" 4、查询小组成员成绩信息 8、保存小组成员信息到文件\n");
printf("\n");
printf("\n");
printf(" 9.从文件导入 \n");
printf("\n");
printf("\n");
printf(" 0、返回主菜单ok\n");
printf("\n");
printf("\n");
printf(" 请输入序号<1-9>:_____\b\b\b");
scanf("%s",&a);
switch(a)
{
case '1':
{
he=add(he);
managemenus();
break;
}
case '2':
{
he=revise(he);
managemenus();
break;
}
case '3':
{
showfile(he);
managemenus();
break;
}
case '4':
{
search(he);
break;
}
case '6':
{
showfile(he);
he=idelete(he);
managemenus();
break;
}
case '7':
{
he=alter(he);
managemenus();
break;
}
case '8':
{
output(he);
break;
}
case '5':
{
he=add2(he,NULL);
break;
}
case '9':
{
he=import();
showfile(he);
managemenu();
break;
}
case '0':
{
mainmenu();
break;
}
default :
{
printf("\n \n ");
system("pause");
system("cls");
managemenus();
break;
}
}
}
文件14 newtitle.c 功能:标题
void title()
{
system("cls");
printf("\n\n\n");
printf(" 学习小组成绩管理系统\n");
printf(" Learning Group Performance Management System\n");
printf("------------------------------------------------------------------------------------------------------------------------");
printf("------------------------------------------------------------------------------------------------------------------------\n");
}
文件15 output.c 功能:导出文件
#include"main.h"
struct student *output(struct student *head)
{
system("cls");
title();
int cc=0;
FILE *write;
char filename[20];
extern char nam[200];
extern char zuz[20];
char a[20];
struct student *p1,*p2;
int b;
if (head == NULL)
{
system("cls");
title();
printf(" 没有学生信息,保存失败\n ");
system("pause");
managemenu();
}
p1 = p2 = head;
system("cls");
title();
printf("\n\n\n\n 确定导出文件吗?");
yonmenu();
scanf("%d",&b);
if(b!=1)
managemenu();
else
{
system("cls");
title();
printf("\n\n\n\n 请输入保存的文件名: ");
scanf("%s",filename);
//链接后缀名
write = fopen(filename,"w");
system("cls");
title();
printf(" 请选择文件保存方式:\n");
printf(" 1.以表格形式保存\n优点:文件外观美观大方,制作精良。缺点:无法再次导入到本系统,无法导入到其他第三方软件进行二次利用。\n\n");
printf(" 2.以输入形式保存\n优点:可以再次导入到本系统,可以导入到其他第三方软件进行二次利用。缺点:文件本身外观简陋,不便于直接阅读\n");
printf(" 请输入序号<1-2>:_____\b\b\b");
scanf("%s",&b);
switch(b)
{
case '1':
{
strcat(filename,".txt");
write = fopen(filename,"w");
fprintf(write," %s 考试成绩\n 组长:%s\n",nam,zuz);
fprintf(write," ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
fprintf(write," ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
while(p1 != NULL)
{
cc=cc+1;
fprintf(write," ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
fprintf(write," ║%-6d║%-16s",cc,p1->name);
fprintf(write,"║%-16s",p1->number);
fprintf(write,"║%-8d",p1->score[0]);
fprintf(write,"║%-8d",p1->score[1]);
fprintf(write,"║%-8d",p1->score[2]);
fprintf(write,"║%-8d",p1->score[3]);
fprintf(write,"║%-8d║\n",p1->all);
p1 = p1->next;
}
fprintf(write," ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
fclose(write);
system("cls");
title();
printf("\n\n\n\n 保存成功!\n ");
system("pause");
managemenu();
break;
}
case '2':
{
strcat(filename,".dat");
write = fopen(filename,"w");
while(p1 != NULL)
{
fprintf(write,"%s %s %d %d %d %d",p1->name,p1->number,p1->score[0],p1->score[1],p1->score[2],p1->score[3]);
p1 = p1->next;
}
fflush(stdin);
fclose(write);
system("cls");
title();
printf("\n\n\n\n 保存成功!\n ");
system("pause");
managemenu();
break;
}
default:
{
system("cls");
title();
printf("输入失败。将返回主菜单\n");
system("pause");
managemenus();
}
}
}
}
文件16 revise.c 功能:修改
#include"main.h"
struct student *revise(struct student *head)
{
struct student *p1,*p2;
extern struct student *he ;
int a,b,f=1;
char num[20];
if (head == NULL)
{
system("cls");
title();
printf(" \n\n\n\n 没有学生信息,无法进行修改!\n ");
system("pause");
return;
}
printf("所有学生信息如下:\n");
show(he);
system("cls");
title();
printf("\n\n 确定修改成绩与信息吗?确定请按1,按其他键自动返回上级菜单。\n");
yonmenu();
scanf("%d",&b);
if(b!=1)
managemenu();
else
{
system("cls");
title();
show(head);
printf(" 请输入需要修改的学生学号: ");
scanf("%s",&num);
p2 = p1 = head;
while(strcmp(p1->number,num)!=0) //查找学生学号
{
if (p1->next == NULL)
break;
p2 = p1;
p1 = p1->next;
}
if (strcmp(p1->number,num)==0)
{
system("cls");
title();
printf("\n 查询到该学生!信息如下:\n");
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 选择修改的内容\n");
printf(" 1.学号 ");
printf("2.姓名\n\n");
printf(" 3.语文成绩 ");
printf("4.数学成绩\n\n");
printf(" 5.英语成绩 ");
printf("6.综合成绩\n\n");
printf(" 请选择序号: ");
scanf("%d",&a);
switch(a)
{
case 1:
{
system("cls");
title();
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 请输入该学生改正的学号信息: ");
while(!scanf("%s",&p1->number))
{
printf(" 输入改正信息有误,请重新输入: ");
fflush(stdin);
}
break;
}
case 2:
{
system("cls");
title();
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 请输入该学生改正的姓名信息: ");
while(!scanf("%s",p1->name))
{
printf(" 输入改正信息有误,请重新输入: ");
fflush(stdin);
}
break;
}
case 3:
{
system("cls");
title();
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 请输入该学生改正的语文成绩信息: ");
while(!scanf("%d",&p1->score[0]))
{
printf(" 输入改正信息有误,请重新输入: ");
fflush(stdin);
}
p1->all=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];
break;
}
case 4:
{
system("cls");
title();
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 请输入该学生改正的数学成绩信息: ");
while(!scanf("%d",&p1->score[1]))
{
printf(" 输入改正信息有误,请重新输入: ");
fflush(stdin);
}
p1->all=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];
break;
}
case 5:
{
system("cls");
title();
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 请输入该学生改正的英语成绩信息: ");
while(!scanf("%d",&p1->score[2]))
{
printf(" 输入改正信息有误,请重新输入: ");
fflush(stdin);
}
p1->all=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];
break;
}
case 6:
{
system("cls");
title();
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
printf(" 请输入该学生改正的文理综合成绩信息: ");
while(!scanf("%d",&p1->score[3]))
{
printf(" 输入改正信息有误,请重新输入: ");
fflush(stdin);
}
p1->all=p1->score[0]+p1->score[1]+p1->score[2]+p1->score[3];
break;
}
}
printf(" 修改成功,该学生改正后的信息为: \n");
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
system("pause");
}
else
{
system("cls");
title();
printf(" \n\n\n\n 没有学生信息,结束修改\n ");
}
system("pause");
managemenu();
return head;
}
}
文件17 search.c 功能:查询
#include "main.h"
void search(struct student *head)
{
extern struct student *he;
system("cls");
title();
struct student *p1;
int f=1;
char num[20];
if (head == NULL) //对查询空链表时的操作
{
printf("\n\n\n\n\n 没有学生信息,结束查询\n");
system("pause");
managemenu();
}
p1 = head;
printf("\n\n\n\n\n 请输入需要查询的学生学号:<_________>\b\b\b\b\b\b\b\b\b\b ");
scanf("%s",&num);
while(strcmp(p1->number,num)!=0)
{
if (p1->next == NULL) break;
p1 = p1->next;
}
if (strcmp(p1->number,num)==0)
{
system("cls");
title();
printf("\n\n\n 查询到该学生!信息如下:\n");
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",f);
printf("║%-16s",p1->name);
printf("║%-16s",p1->number);
printf("║%-8d",p1->score[0]);
printf("║%-8d",p1->score[1]);
printf("║%-8d",p1->score[2]);
printf("║%-8d",p1->score[3]);
printf("║%-8d║\n",p1->all);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
system("pause");
managemenu();
}
else
{
system("cls");
title();
printf("\n\n\n 找不到该学生!\n");
system("pause");
managemenu();
}
}
文件18 show.c 功能:输出信息
#include "main.h"
void *show(struct student *L)
{
extern struct student *he;
system("cls");
title();
extern int max;
struct student *p;
p=L;
int cc=0;
if(L==NULL)
printf("\n\n\n\n\n 没有数据!");
if(L)
{
printf("所有学生信息如下:\n");
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
do
{
cc=cc+1;
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
printf(" ║%-6d",cc);
printf("║%-16s",p->name);
printf("║%-16s",p->number);
printf("║%-8d",p->score[0]);
printf("║%-8d",p->score[1]);
printf("║%-8d",p->score[2]);
printf("║%-8d",p->score[3]);
printf("║%-8d║\n",p->all);
p=p->next;
}
while(p!=NULL);
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
}
system("pause");
}
void *showfile(struct student *L)
{
extern struct student *he;
system("cls");
title();
extern int max;
struct student *p;
p=L;
int cc=0;
int i;
if(L==NULL)
printf("\n\n\n\n\n 没有数据!");
printf("所有学生信息如下:\n");
printf(" ╔═══╦════════╦════════╦════╦════╦════╦════╦════╗\n");
printf(" ║ 序号 ║ 姓名 ║ 学号 ║ 语文 ║ 数学 ║ 英语 ║ 综合 ║ 总分 ║\n");
for(i=0;i<=counting(L);i++)
{
printf(" ╠═══╬════════╬════════╬════╬════╬════╬════╬════╣\n");
cc=cc+1;
printf(" ║%-6d",cc);
printf("║%-16s",p->name);
printf("║%-16s",p->number);
printf("║%-8d",p->score[0]);
printf("║%-8d",p->score[1]);
printf("║%-8d",p->score[2]);
printf("║%-8d",p->score[3]);
printf("║%-8d║\n",p->all);
p=p->next;
}
printf(" ╚═══╩════════╩════════╩════╩════╩════╩════╩════╝\n");
system("pause");
}
文件19 welcome.c 功能:欢迎界面
void welcome()
{
title();
printf("\n\n");
printf(" 学习小组成绩管理系统(Learning Group Performance Management System)是一款可以有效\n");
printf(" 进行学习小组内部成员成绩信息管理的小型软件。软件使用人可以利用这款软件轻松对学习小组成员\n");
printf(" 考试信息进行管理,查看,可以方便对学习小组信息进行编辑修改,可以快速分析学习小组成员的整\n");
printf(" 体成绩。\n");
printf(" *请把窗口大小调整为120*30以获得最佳界面效果。\n\n\n\n");
printf(" 按任意键进入系统……\n");
printf("\n\n\n\n\n");
printf(" 东北林业大学 \n");
printf(" 信息与计算机工程学院 软件工程2016级2班 张峻巍\n");
printf("\n\n");
printf(" V1.0 Copyright (c) 2017 All rights reserved. \n");
system("pause");
}
文件20 yonmenu.c 功能:退出菜单
void yonmenu()
{
int a;
printf("\n\n");
printf(" 1、是");
printf("\n\n");
printf(" 2、否");
printf("\n\n");
printf(" 按其他任意键返回主菜单 \n\n");
printf(" 请输入序号:<___>\b\b\b");
}
文件21 头文件 main.h
#ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include"main.h"
void welcome();
void mainmenu();
void groupsetting();
void managemenu();
void managemenus();
void information();
void exitmenu();
void title();
struct student *add();
void addsuccessful();
void *show(struct student *L);
void inquiry();
struct Student *del(struct student *head);
struct student *add2(struct student *head,struct student *stu);
void sort();
void save();
struct student *idelete(struct student *head);
struct student *add(struct student *head);
struct student *output(struct student *head);
struct student *input(struct student *head);
struct student *revise(struct student *head);
struct student *alter(struct student *head);
void read();
int counting(struct student *head);
void *showfile(struct student *L);
void importsuccess();
void altertitle();
struct student *import();
int *max_c(struct student *head);
int *min_c(struct student *head);
struct student
{
char name[20];
int n;
int no;
char number[20];
char sex;
int score[4];
int all;
struct student *next;
};
void yonmenu();
//printf("\n");
#endif // MAIN_FUNCTION_H_INCLUDED
头文件中有部分在制作过程中舍弃的未使用函数。
以上便是学习小组成绩系统的全部代码。