学生成绩管理系统

本文介绍了一个学生信息管理系统的设计与实现,包括学生数据的增删改查、排序、统计分析等功能,使用C语言进行开发,涉及数据结构、文件操作、字符串处理等核心技术。

在这里插入图片描述

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct _STU
{
	int no;//学号
	char name[20];//姓名
	int score[6];//分数
	int num;//有多少门课
	int sum;//总分
}STU,*PSTU; 

void Print_Stu_Info(PSTU stu,int n)
{
	int i,j;
	float sum;
	system("cls");
	printf("%-10s%-10s%-24s%-5s%-5s\n","学号","姓名","成绩","总分","平均分");
	for(i=0;i<n;i++)
	{
		printf("%-10d%-10s",stu[i].no,stu[i].name);
		for(j=0,sum=0;j<stu[i].num;j++)
		{
			printf("%-4d",stu[i].score[j]);
		}
		while(j<6)
		{
			printf("%-4s","");
			j++;
		}
		printf("%-5d",stu[i].sum);
		printf("%-5.2f\n",stu[i].sum*1.0/stu[i].num);
	}
	system("pause");
}

void Sort_Sum_High_To_Low(PSTU stu,int n)
{
	int i,j;
	STU temp;
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(stu[i].sum<stu[j].sum)
			{
				temp=stu[i];
				stu[i]=stu[j];
				stu[j]=temp;
			}
		}
	}
	system("cls");
	printf("%-10s%-10s%-24s%-5s%-8s%-5s\n","学号","姓名","成绩","总分","平均分","名次");
	for(i=0;i<n;i++)
	{
		printf("%-10d%-10s",stu[i].no,stu[i].name);
		for(j=0;j<stu[i].num;j++)
		{
			printf("%-4d",stu[i].score[j]);
		}
		while(j<6)
		{
			printf("%-4s","");
			j++;
		}
		printf("%-5d",stu[i].sum);
		printf("%-8.2f",stu[i].sum*1.0/stu[i].num);
		printf("%-5d\n",i+1);
	}
	system("pause");
}

void Sort_No_Low_To_High(PSTU stu,int n)
{
	int i,j;
	STU temp;
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(stu[i].no>stu[j].no)
			{
				temp=stu[i];
				stu[i]=stu[j];
				stu[j]=temp;
			}
		}
	}
	Print_Stu_Info(stu,n);
}

void Sort_Name_Low_To_High(PSTU stu,int n)
{
	int i,j;
	STU temp;
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(strcmp(stu[i].name,stu[j].name)>0)
			{
				temp=stu[i];
				stu[i]=stu[j];
				stu[j]=temp;
			}
		}
	}
	Print_Stu_Info(stu,n);
}

int Add_New_Stu(PSTU stu,int n)
{
	int i;
	system("cls");
	printf("输入学号:");
	scanf("%d",&stu[n].no);
	printf("输入姓名:");
	scanf("%s",stu[n].name);
	printf("有多少门课:");
	scanf("%d",&stu[n].num);
	stu[n].sum=0;
	for(i=0;i<stu[n].num;i++)
	{
		printf("第%d门课成绩:",i+1);
		scanf("%d",&stu[n].score[i]);
		stu[n].sum += stu[n].score[i];
	}
	printf("录入成功!\n");
	system("pause");
	return n+1;
}

void Save_Info(PSTU stu,int n)
{
	int i;
	char path[100];
	FILE* pFile;
	system("cls");
	printf("请输入保存文件路径:");
	scanf("%s",path);
	pFile= fopen(path,"w+");
	if(pFile==NULL)
	{
		printf("文件保存失败!\n");
		system("pause");
		return;
	}
	for(i=0;i<n;i++)
	{
		fwrite(&stu[i],1,sizeof(STU),pFile);
	}
	fclose(pFile);
	printf("文件保存成功!\n");
	system("pause");
}

int Read_Info(PSTU stu)
{
	int i=0;
	char path[100];
	FILE* pFile;
	system("cls");
	printf("请输入读取文件路径:");
	scanf("%s",path);
	pFile= fopen(path,"r+");
	if(pFile==NULL)
	{
		printf("文件读取失败!\n");
		system("pause");
		return 0;
	}
	while(fread(&stu[i++],1,sizeof(STU),pFile));
	fclose(pFile);
	printf("文件读取成功!\n");
	system("pause");
	if(i>=1)
	{
		return i-1;
	}
	return 0;
}

int menu()
{
	int choice;
	system("cls");

	printf("1:Read from a file\n");
	printf("2:Calculate total and average score of every course\n");
	printf("3:Calculate total and average score of every student\n");
	printf("4:Sort in descending order by total score of every student\n");
	printf("5:Sort in ascending order by number\n");
	printf("6:Sort in dictionary order by name\n");
	printf("7:Search by number\n");
	printf("8:Search by name\n");
	printf("9:Statistic analysis for every course\n");
	printf("10:List record\n");
	printf("11:Write to file\n");
	printf("0:Exit\n");
	printf("12:测试输入\n");
	printf("Please choice:");
	scanf("%d",&choice);
	while(choice<0||choice>12)
	{
		printf("Please choice again:");
		scanf("%d",&choice);
	}

	return choice;
}

void Calc_Stu_Sum(PSTU stu,int n)
{
	int i;
	system("cls");
	printf("%-10s%-10s%-5s%-5s\n","学号","姓名","总分","平均分");
	for(i=0;i<n;i++)
	{
		printf("%-10d%-10s",stu[i].no,stu[i].name);
		printf("%-5d",stu[i].sum);
		printf("%-5.2f\n",1.0*stu[i].sum/stu[i].num);
	}
	system("pause");
}

void Calc_Course_Sum(PSTU stu,int n)
{
	int i,j;
	float sum[6]={0};
	system("cls");
	printf("%-10s%-10s%-5s%-5s\n","学号","姓名","总分","平均分");
	for(i=0;i<n;i++)
	{
		printf("%-10d%-10s",stu[i].no,stu[i].name);
		for(j=0;j<stu[i].num;j++)
		{
			sum[j]+=stu[i].score[j];
		}
	}
	for(i=0;i<stu[i].num;i++)
	{
		printf("科目%d  总分:%5.0f   平均分:%5.2f\n",i+1,sum[i],sum[i]/n);
	}
	system("pause");
}

void Search_By_No(PSTU stu,int n)
{
	int temp,i;
	system("cls");
	printf("请输入要查找的学号:");
	scanf("%d",&temp);
	for(i=0;i<n;i++)
	{
		if(temp==stu[i].no)
		{
			Print_Stu_Info(&stu[i],1);
			return ;
		}
	}
	printf("无该学号信息!\n");
	system("pause");
}

void Search_By_Name(PSTU stu,int n)
{
	int i;
	char temp[20];
	system("cls");
	printf("请输入要查找的名字:");
	scanf("%s",temp);
	for(i=0;i<n;i++)
	{
		if(!strcmp(temp,stu[i].name))
		{
			Print_Stu_Info(&stu[i],1);
			return ;
		}
	}
	printf("无该姓名信息!\n");
	system("pause");
}

void Total_All_info(PSTU stu,int n)
{
	int i,j,sum[6][5]={0};
	system("cls");
	for(i=0;i<n;i++)
	{
		for(j=0;j<stu[i].num;j++)
		{
			switch(stu[i].score[j]/10)
			{
			case 10:
			case 9:
				sum[j][0]++;
				break;
			case 8:
				sum[j][1]++;
				break;
			case 7:
				sum[j][2]++;
				break;
			case 6:
				sum[j][3]++;
				break;
			default:
				sum[j][4]++;
				break;
			}
		}
	}
	printf("%-10s%-10s%-10s%-10s%-10s%-10s\n","","优秀","良好","中等","及格","不及格");
	for(i=0;i<stu[0].num;i++)
	{
		printf("科目%-5d",i+1);
		for(j=0;j<5;j++)
		{
			printf(" %-2d %-4.2f%% ",sum[i][j],sum[i][j]*1.0/n*100);
		}
		printf("\n");
	}
	system("pause");
}


int main()
{
	int choice;
	STU stu[30];
	int NUM=0;//记录人数
	do
	{
		choice=menu();
		switch(choice)
		{
		case 1:
			NUM=Read_Info(stu);
			break;
		case 2:
			Calc_Course_Sum(stu,NUM);
			break;
		case 3:
			Calc_Stu_Sum(stu,NUM);
			break;
		case 4:
			Sort_Sum_High_To_Low(stu,NUM);
			break;
		case 5:
			Sort_No_Low_To_High(stu,NUM);
			break;
		case 6:
			Sort_Name_Low_To_High(stu,NUM);
			break;
		case 7:
			Search_By_No(stu,NUM);
			break;
		case 8:
			Search_By_Name(stu,NUM);
			break;
		case 9:
			Total_All_info(stu,NUM);
			break;
		case 10:
			Print_Stu_Info(stu,NUM);
			break;
		case 11:
			Save_Info(stu,NUM);
			break;
		case 12:
			NUM=Add_New_Stu(stu,NUM);
			break;
		}
	}while(choice!=0);

	return 0;
}
一篇很完整、很不错的论文、希望你们喜欢 摘要 学生成绩管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强.数 据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点。 经过分析如此情况,我们使用Microsoft公司的visualstudio开发工具,利用其提供的各种面向对象的开发工具,尤其是数据窗口这一能方便而简洁操纵数据库的智能化对象,首先在短时间内建立系统应用原型,然后,对初始原型系统进行需求迭代,不断修正和改进,直到形成用户满意的可行系统。 关键词:sql2000,c#,数据一致性,信息管理系统。 Abstract:Student achievement management system is representative information management system (MIS) , whose development mainly consists of two aspects: building and maintain of backward database and development of foreward application program.To the former, we must build a database who has great data-consistence,great data-completion and good data-security. But to the later,that the application program has enough functions and is case to use is required. After analysing so-called condition, we decide to use visualstudio of Microsoft corporation, exploitation implement, utilizing the implement who provides all kinds of face to the object, especially the data window of intellectualized which is able to controlit by concise and convenient,first,we should build the systerm application prototype in a short time,then, carry out the system needing iteration , amending and improving unceasingly, until the consumer satisfied with the viable system which is formed. Key words:sql2000,c# , data window , information management system. 一、引言 1.1 项目开发背景 几年前,各个学校的学生成绩管理基本上都是靠手工进行,随着各个学校的规模增大,有关学生成绩管理工作所涉及的数据量越来越大,有的学校不得不靠增加人力、物力来进行学生成绩管理.但手工管理具有效率底、易出错、对学校的管理提供决策信息较为困难等缺点.我校尽管部分学院或系已开出学生成绩管理系统,但开发的系统不具有通用性,所以我想借本次毕业设计之际,开发一个不仅适用本校各系而且适用于其它各校的通用高校学生成绩管理系统. 采用软件工程的指导方法,选用C/S模式设计的方案,应用SQL Server 2000数据库管理系统,C#程序设计语言,Visual Studio.NET 2003开发工具等开发出来的基于WINDOWS系列的学生学籍管理系统.该系统面向各部门和全体学生,实现对学生成绩情况、学籍情况等的计算机管理系统支持学生查询自己的学籍信息和成绩信息,还可以修改自己的密码,而教师可以对学生的学籍信息和成绩信息进行添加、删除和修改等的操作,同时本系统支持报表的输出打印功能。减少了部门之间工作的中间环节,提高了跨部门管理的效率。 1.2 项目开发的目标 建立学生成绩管理系统,采用计算机对学生成绩进行管理,进一步提高办学效益和现代化水平.帮助广大教师提高工作效率,实现学生成绩信息管理工作流程的系统化、规范化和自动化. 1.3 项目提出的意义 现在我国的大中专院校的学生成绩管理水平普遍不高,有的还停留在纸介质基础上,这种管理手段已不能适应时代的发展,因为它浪费了了许多的人力和物力.在当今信息时代这种传统的管理方法必然被计算机为基础的信息管理系统所代替.如果本系统能被学校所采用,将会改变以前靠手工管理学生成绩的状况,可以树立良好的办学形象,提高工作效率. 二、常用的软件开发方法 2.1 结构化系统开发方法 2.1.1 结构化系统开发的基本思想 用系统工程的思想和工程化的方法,按照用户至上的原则,采取结构化、模块化、自顶向下的方法对系统进行分析与设计。 2.1.2 结构化系统开发方法的特点 1.强调用户的参与。 2.深入调查研究。 3.使用结构化、模块化方法。 4.严格按照阶段进行。 5.开发过程工程化。 2.1.3 结构化系统开发方法的阶段划分 1、系统规划阶段 根据用户的系统开发要求,初步调查,明确问题,然后进行可行性研究。 2、系统分析阶段 系统分析阶段的主要任务是分析业务流程,分析数据与数据流程,提出新系统的逻辑方案。 3、系统设计阶段 系统时间阶段的主要任务是总体结构设计和模块设计。根据设计要求选择合适的软硬件设备,进行代码、用户界面、文件、数据库、网络结构的设计。 4系统实施阶段 系统实施阶段的主要任务包括编程、操作人员培训以及数据准备,然后投入试运行。 5、系统运行阶段 系统运行阶段的主要任务是进行系统的日常运行管理、评价、审计工作。 2.2 原型开发方法 2.2.1 原型的概念 原型开发方法首先有用户提出开发要求,开发人员识别和归纳用户需求,根据识别、归纳的结果,构造出一个原型,然后同用户一起评价这个原型。如果根本不行,则重新构造原型;如果不满意,则修改原型,直到用户满意为此。 原型按照建立的目的不同可分为抛弃型原型和增量渐进型原型。 2.2.2 抛弃型原型 抛弃型原型主要用于验证软件需求以及设计方案和算法,这是当前使用较广泛的原型。 抛弃型原型开发模型如下:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值