设计一个C语言学生成绩管理系统

作者&投稿:骆瑶 (若有异议请与网页底部的电邮联系)
c语言实现设计一个学生成绩管理系统课程~

参考代码如下,不过还是建议自己写一写比较好:
#include
#include
#include
struct student //结构体
{
char name[20]; //姓名
char number[20]; //学号
double math; //数学
double english; //英语
double chinese; //语文
double program; //程序
}s[50];

void head() //界面
{
printf(
"**********************************************************************
"
"** **
"
"** **
"
"** 学生成绩管理系统 **
"
"** **
"
"** 1.信息录入 **
"
"** 2.信息统计 **
"
"** 3.信息浏览 **
"
"** 4.信息查询 **
"
"** 5.信息排序 **
"
"** 6.信息删除 **
"
"** 0.退出系统 **
"
"** **
"
"**********************************************************************
"
);
}
void daoru(struct student s[], int* n) //文件导入函数
{
FILE *p;
int i=*n;
if((p=fopen("数据.txt", "r"))==NULL)
{
n=n;
}
else
{
while(!feof(p))
{
fscanf(p, "%s%s%lf%lf%lf%lf
", s[i].name, s[i].number, &s[i].math, &s[i].english, &s[i].chinese, &s[i].program);
i++;
*n=*n+1;
}
}
fclose(p);
}
void daochu(struct student s[], int n)
{
FILE *p;
int i=0;
if((p=fopen("数据.txt", "w"))==NULL)
{
printf("无法打开此文件!");
}
else
{
while(i<n-1)
{
fprintf(p, "%s %s %lf %lf %lf %lf
", s[i].name, s[i].number, s[i].math, s[i].english, s[i].chinese, s[i].program);
i++;
}
fprintf(p, "%s %s %lf %lf %lf %lf", s[i].name, s[i].number, s[i].math, s[i].english, s[i].chinese, s[i].program);
}
fclose(p);
}
void dayin(struct student s[], int n) //显示所有信息
{
int i;
double all=0.0;
printf("
姓名学号数学英语语文程序总分
");
for (i=0; i<n; i++)
{
all=s[i].math+s[i].english+s[i].chinese+s[i].program;
printf("%s%s%.1lf%.1lf%.1lf%.1lf%.1lf
", s[i].name, s[i].number, s[i].math, s[i].english, s[i].chinese, s[i].program, all);
}
}
void shuru(struct student s[], int* n) //信息输入函数
{
int i=*n, j, k, m;
printf("请输入学生姓名:");
scanf("%s", s[i].name);
printf("请输入学生学号:");
for (j=0; ; j++)
{
m=0;
scanf("%s", s[i].number);
for (k=0; k<i; k++)
{
if (strcmp(s[i].number, s[k].number)==0)
{
m=m+1;
printf("学号重复,请重新输入学号:");
break;
}
}
if (m==0)
{
break;
}
}
printf("请输入数学成绩:");
scanf("%lf", &s[i].math);
printf("请输入英语成绩:");
scanf("%lf", &s[i].english);
printf("请输入语文成绩:");
scanf("%lf", &s[i].chinese);
printf("请输入程序成绩:") ;
scanf("%lf", &s[i].program);
printf("添加信息成功!
");
*n=*n+1;
daochu(s, *n);
}
void paixu(struct student s[], int n) //排序函数
{
int i, j;
double all1, all2;
struct student stu;
for (i=0; i<n-1; i++)
{
for (j=i+1; j<n; j++)
{
all1=s[i].math+s[i].english+s[i].chinese+s[i].program;
all2=s[j].math+s[j].english+s[j].chinese+s[j].program;
if (all1<all2)
{
stu=s[i];
s[i]=s[j];
s[j]=stu;
}
}
}
printf("排序后的数据:
");
dayin(s, n);
}
void chazhao(struct student s[], int n) //查找函数
{
char name[20], num[20];
int m1, m2=0, i, j;
printf("1.按姓名查找
2.按学号查找
选择查询方式(1或2):");
scanf("%d", &m1);
if (m1==1)
{
printf("请输入您要查找的学生姓名:");
scanf("%s", name);
for (i=0; i<n; i++)
{
if (strcmp(s[i].name, name)==0)
{
m2=m2+1;
if (m2==1)
{
printf("
姓名学号数学英语语文程序
");
}
printf("%s%s%s%s%s
", s[i].name, s[i].number, s[i].math, s[i].english, s[i].chinese, s[i].program);
}
}
if (m2==0)
{
printf("没有此学生信息!
");
}
}
else if (m1==2)
{
printf("请输入您要查找的学生学号:");
scanf("%s", num);
j=0;
for (i=0; i<n; i++)
{
if (strcmp(s[i].number, num)==0)
{
m2=m2+1;
if (m2==1)
{
printf("
姓名学号数学英语语文程序
");
}
printf("%s%s%s%s%s
", s[i].name, s[i].number, s[i].math, s[i].english, s[i].chinese, s[i].program);
}
}
if (m2==0)
{
printf("没有此学生信息!
");
}
}
}
void shanchu(struct student s[], int* n) //删除函数
{
char num[20];
int m=0, i, j;
printf("请输入您要删除的学生学号:");
scanf("%s", num);
for (i=0; i<=*n; i++)
{
if (strcmp(s[i].number, num)==0)
{
m=m+1;
for (j=i; j<*n; j++)
{
s[j]=s[j+1];
}
*n=*n-1;
}
}
if (m==0)
{
printf("没有此学生信息!
");
}
else
{
daochu(s, *n);
printf("删除完毕!
");
}
}
void allAndAver(struct student s[], int n)
{
int i ;
double all=0.0, aver=0.0;
for (i=0; i<n; i++)
{
all=s[i].math+s[i].english+s[i].chinese+s[i].program;
aver=all/4;
printf("%s%s%.1lf%.1lf
", s[i].name, s[i].number, all, aver);
}
}
void Fail(struct student s[], int n) //统计单科不及格人数
{
int i, fail[4]={0};
for (i=0; i<n; i++)
{
if (s[i].math<60)
{
fail[0]++;
}
if (s[i].english<60)
{
fail[1]++;
}
if (s[i].chinese<60)
{
fail[2]++;
}
if (s[i].program<60)
{
fail[3]++;
}
}
printf("
不及格信息:
");
printf("数学不及格的人数为:%d人
", fail[0]);
printf("英语不及格的人数为:%d人
", fail[1]);
printf("语文不及格的人数为:%d人
", fail[2]);
printf("程序不及格的人数为:%d人
", fail[3]);
}
void Max(struct student s[], int n) //统计单科最高分人数
{
int i, counter[4]={0};
double max[4]={s[0].math, s[0].english, s[0].chinese, s[0].program};
for (i=0; i<n; i++)
{
if (s[i].math>max[0])
{
max[0]=s[i].math;
}
if (s[i].math>max[1])
{
max[1]=s[i].math;
}
if (s[i].math>max[2])
{
max[2]=s[i].math;
}
if (s[i].math>max[3])
{
max[3]=s[i].math;
}
}
for (i=0; i<n; i++)
{
if (s[i].math==max[0])
{
counter[0]++;
}
if (s[i].math==max[1])
{
counter[1]++;
}
if (s[i].math==max[2])
{
counter[2]++;
}
if (s[i].math==max[3])
{
counter[3]++;
}
}
printf("
最高分信息:
");
printf("数学最高分为:%.1lf, 人数为:%d人
", max[0], counter[0]);
printf("英语最高分为:%.1lf, 人数为:%d人
", max[1], counter[1]);
printf("语文最高分为:%.1lf, 人数为:%d人
", max[2], counter[2]);
printf("程序最高分为:%.1lf, 人数为:%d人
", max[3], counter[3]);
}
void Min(struct student s[], int n) //统计单科最低分人数
{
int i, counter[4]={0};
double min[4]={s[0].math, s[0].english, s[0].chinese, s[0].program};
for (i=0; i<n; i++)
{
if (s[i].math<min[0])
{
min[0]=s[i].math;
}
if (s[i].math<min[1])
{
min[1]=s[i].math;
}
if (s[i].math<min[2])
{
min[2]=s[i].math;
}
if (s[i].math<min[3])
{
min[3]=s[i].math;
}
}
for (i=0; i<n; i++)
{
if (s[i].math==min[0])
{
counter[0]++;
}
if (s[i].math==min[1])
{
counter[1]++;
}
if (s[i].math==min[2])
{
counter[2]++;
}
if (s[i].math==min[3])
{
counter[3]++;
}
}
printf("
最低分信息:
");
printf("数学最低分为:%.1lf, 人数为:%d人
", min[0], counter[0]);
printf("英语最低分为:%.1lf, 人数为:%d人
", min[1], counter[1]);
printf("语文最低分为:%.1lf, 人数为:%d人
", min[2], counter[2]);
printf("程序最低分为:%.1lf, 人数为:%d人
", min[3], counter[3]);
}
void tongji(struct student s[], int n) //统计函数
{
printf("统计信息如下:
");
printf("
姓名学号总分平均分
");
allAndAver(s, n);
Max(s, n);
Min(s, n) ;
Fail(s, n);
}
int main() //主函数
{
int k, n=0;
daoru(s, &n);
daochu(s, n);
while (1)
{
head();
printf("
请按对应的键选择相应的功能:");
scanf("%d",&k);
switch (k)
{
case 1:
shuru(s, &n);
break;
case 2:
tongji(s, n);
break;
case 3:
dayin(s, n);
break;
case 4:
chazhao(s, n);
break;
case 5:
paixu(s, n);
break;
case 6:
shanchu(s, &n);
break;
case 0:
exit(1);
break;
default : printf("请输入正确的命令!
");
}
system("pause");
system("cls");
}
return 0;
}

#include #include
#include #define MAX 1000/*定义学生成绩信息结构*/struct stu{
char id[8];char name[8];


扩展资料:
short:修饰int,短整型数据,可省略被修饰的int。(K&R时期引入)
long:修饰int,长整型数据,可省略被修饰的int。(K&R时期引入)
long long:修饰int,超长整型数据,可省略被修饰的int。(C99标准新增)
signed:修饰整型数据,有符号数据类型。(C89标准新增)
unsigned:修饰整型数据,无符号数据类型。(K&R时期引入)
restrict:用于限定和约束指针,并表明指针是访问一个数据对象的唯一且初始的方式。(C99标准新增)
复杂类型关键字
struct:结构体声明。(K&R时期引入)
union:联合体声明。(K&R时期引入)
enum:枚举声明。(C89标准新增)
typedef:声明类型别名。(K&R时期引入)
sizeof:得到特定类型或特定类型变量的大小。(K&R时期引入)
inline:内联函数用于取代宏定义,会在任何调用它的地方展开。(C99标准新增)
参考资料来源:百度百科-c语言

给你一个参考;记住学习永远是自己的,要学会自己思考,真学实用

/*用链表实现学生成绩信息的管理*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct stud_node
{
int num;
char name[20];
int score;
struct stud_node *next;
};
struct stud_node *Create_Stu_Doc();/*新建链表*/
struct stud_node *InsertDoc(struct stud_node *head,struct stud_node *stud);/*插入*/
struct stud_node *DeleteDoc(struct stud_node *head,int num);/*删除*/
void Print_Stu_Doc(struct stud_node *head);/*遍历*/

int main(void)
{
struct stud_node *head,*p;
int choice,num,score;
char name[20];
int size=sizeof(struct stud_node);

do
{
printf("1:添加 2:插入 3:删除 4:打印 0:退出\n");
scanf("%d",&choice);
switch(choice)
{
case 1:head=Create_Stu_Doc();break;
case 2:printf("请输入学号,姓名和成绩:\n");
scanf("%d%s%d",&num,name,&score);
p=(struct stud_node *)malloc(size);
p->num=num;
strcpy(p->name,name);
p->score=score;
head=InsertDoc(head,p);
break;
case 3:
printf("请输入学号:\n");
scanf("%d",&num);
head=DeleteDoc(head,num);
break;
case 4:
Print_Stu_Doc(head);
break;
case 0:break;
}
}while(choice!=0);

return 0;
}

/*新建链表*/
struct stud_node *Create_Stu_Doc()
{
struct stud_node *head,*p;
int num,score;
char name[20];
int size=sizeof(struct stud_node);

head=NULL;
printf("请输入学号,姓名和成绩:\n");
scanf("%d%s%d",&num,name,&score);
while(num!=0)
{
p=(struct stud_node*)malloc(size);
p->num=num;
strcpy(p->name,name);
p->score=score;
head=InsertDoc(head,p);/*调用插入函数*/
scanf("%d%s%d",&num,name,&score);
}
return head;
}

/*插入操作*/
struct stud_node *InsertDoc(struct stud_node *head,struct stud_node *stud)
{
struct stud_node *ptr,*ptr1,*ptr2;

ptr2=head;
ptr=stud;/*ptr指向待插入的新的学生记录结点*/
/*原链表为空时的插入*/
if(head==NULL)
{
head=ptr;
head->next=NULL;
}
else/*原链表不为空时的插入*/
{
while((ptr->num>ptr2->num)&&(ptr2->next!=NULL))
{
ptr1=ptr2;/*ptr1,ptr2各后移一个结点*/
ptr2=ptr2->next;
}
if(ptr->num<=ptr2->num)/*在ptr1与ptr2之间插入新结点*/
{
if(head==ptr2)
head=ptr;
else ptr1->next=ptr;
ptr->next=ptr2;
}
else/*新插入结点成为尾结点*/
{
ptr2->next=ptr;
ptr->next=NULL;
}
}
return head;
}

/*删除操作*/
struct stud_node *DeleteDoc(struct stud_node *head,int num)
{
struct stud_node *ptr1,*ptr2;

/*要被删除结点为表头结点*/
while(head!=NULL && head->num==num)
{
ptr2=head;
head=head->next;
free(ptr2);
}
if(head==NULL)/*链表空*/
return NULL;
/*要被删除结点为非表头结点*/
ptr1=head;
ptr2=head->next;/*从表头的下一个结点搜索所有符合删除要求的结点*/
while(ptr2!=NULL)
{
if(ptr2->num==num)/*ptr2所指结点符合删除要求*/
{
ptr1->next=ptr2->next;
free(ptr2);
}
else
ptr1=ptr2;/*ptr1后移一个结点*/
ptr2=ptr1->next;/*ptr2指向ptr1的后一个结点*/
}
return head;
}

/*遍历操作*/
void Print_Stu_Doc(struct stud_node *head)
{
struct stud_node *ptr;
if(head==NULL)
{
printf("\nNo Records\n");
return;
}
printf("\nThe Students' Records Are:\n");
printf("Num\tName Score\n");
for(ptr=head;ptr;ptr=ptr->next)
printf("%8d %20s %6d\n",ptr->num,ptr->name,ptr->score);
}

又是求作业的·······················


c语言学生成绩管理系统
\/*函数add2311,功能:追加学生资料,并且将所有学生资料按学号排序*\/{ score *p0,*p1,*p2,*p3,*max; int i,j; float fen; char t[10]; p3=stu=(score *)malloc(LEN);\/*开辟一个新单元*\/ printf("\\n输入要增加的学生的资料!"); repeat4: printf("请输入学生学号(学号应大于0):");...

C语言编写函数,求10个学生的平均成绩,使用数组
1、首先打开visual studio 2019软件,新建一个win32控制台程序。2、然后在源文件夹下面新建一个C语言文件。3、接着在C语言中导入stdio和stdlib库。4、然后在main函数中输入如下图所示的逻辑代码。5、运行程序以后就可以看到CMD界面,这里需要输入10个成绩。6、最后输完第10个成绩的时候,回车就可以得到...

C语言编程,输入10个学生5门课的成绩,分别用函数实现以下功能:
\/\/lj是最高分的学科,largest是最高分,fc是平均分方差,a是50个成绩的平均分 printf("请输入10个学生的成绩,按照语文、数学、英语、物理、化学的顺序依次输入:\\n");for(i=0;i!=10;++i){ printf("第%d个学生:\\n",i+1);for(j=0;j!=5;++j){ scanf("%f",&score[i][j]);if(...

编写一个C语言程序:输入4个学生4门课的成绩,计算各科不及格的人数? 怎 ...
定义一个整型数组c[4]来作为科目不及格计数器,代码如下 include<iostream> using namespace std;int main(){ int i,j,b[4][4];static int c[4]={0,0,0,0};for (i=0;i<4;i++)for (j=0;j<4;j++)cin>>b[i][j];for (i=0;i<4;i++){for (j=0;j<4;j++)cout<<"...

求一个c语言有三种功能的程序
C语言课程设计任务书一、题目:学生成绩管理二、目的与要求1.目的:(1)基本掌握面向过程程序设计的基本思路和方法;(2)达到熟练掌握C语言的基本知识和技能;(3)能够利用所学的基本知识和技能,解决简单的程序设计问题2.要求基本要求:1.要求利用C语言面向过程的编程思想来完成系统的设计;2.突出C...

c语言……从键盘输入一批学生的成绩,当输入一个负数时结束输入,然后计 ...
include <stdio.h> main(){ double N,M,one;\/\/one记录每次输入的成绩,N记录学生数,M记录总分,使用double记录允许分数为小数 N=0;\/\/学生数初始为0 M=0;\/\/总分初始为0 scanf("%lf",&one);\/\/读入第一个成绩,或表示结束的负数 while(one>=0)\/\/直到读入的数是负数时停止 { N++;\/\/...

求编写一个C语言的程序
include<stdio.h>#include#include<stdlib.h>#define N 10void main(){srand((int)time(NULL));\/\/随机数种子struct Student{char name[20];\/\/int num;};int i=0,num,a,b,c,j;Student stu[10],st;printf("请输入10名竞选者的名字\\n");for(i=0;i<10;i++){scanf("%s",stu[i]...

c语言 循环结构编程 输入若干个学生成绩, 若输入数据大于100或小于0则...
include <stdio.h>#define ARR_LEN 50 \/*数组长度*\/int main(void) {int count,i;float score[ARR_LEN],sum,average;puts("请分别输入每个学生的成绩:"); count = i = sum = 0;while (1) {printf ("第%d个学生:",i+1);scanf ("%f",&score[i]);if (score[i]<=100 && ...

如何在c++定义一个学生类以实现平均成绩的计算和查询功能?
1.定义学生类,包括学号、姓名、性别、多门课程的成绩;假设有n个学生,由键盘输入学生信息;2定义类成员函数,计算每个学生的平均成绩;4.同时输出所有学生信息...1).编程语言不同——AUTOSAR CP基于C语言,而AUTOSAR AP基于C++语言;2).架构不同——AUTOSAR CP 采用的是FOA架构(function-oriented architecture),而...

用C语言编写一个程序
include<stdio.h> int main(){float i,sum;scanf("%f",&i);\/\/输入重量 if(i>50)\/\/超过50时的计费标准 sum=50*0.15+(i-50)*0.1;else\/\/不到50时 的计费标准 sum=50*0.15;printf("\\n%f",sum);\/\/输出费用 }

陇县15021975785: c语言 学生成绩管理系统设计学生成绩信息包括:学号,姓名,三门课程成绩(数学、英语和计算机)等.主要功能:(1) 计算各个学生的总分及平均分,... -
鱼炭扶严:[答案] 希望对你有所帮助.#include"stdio.h"#include"stdlib.h"#include"string.h"#define N 3typedef struct z1{ char no[11]; char name[15]; int score[N]; float sum; float average; int order; ...

陇县15021975785: 编程如何用C语言编写一个学生成绩管理系统程序 -
鱼炭扶严: 我们才做了这个作业... #include <malloc.h> #include <stdio.h> #include <stdlib.h> #define LEN sizeof(struct scorenode) #define DEBUG #include <string.h> struct scorenode { int number;/*学号*/ char name[8];/*姓名*/ float cj1;/*成绩1*/ ...

陇县15021975785: 如何用C语言编一个学生成绩管理系统 -
鱼炭扶严: #include "stdio.h"#include "stdlib.h"#include "string.h"#define NULL 0 int shoudsave=0; struct student { char num[10]; char name[20]; char sex[4]; int cgrade; int mgrade; int egrade; int totle; int ave; char neartime[10]; }; typedef struct node { ...

陇县15021975785: 怎么用c语言编写一个学生成绩管理系统啊?急…… -
鱼炭扶严: C语言课程设计报告-------学生成绩简单管理程序 一、系统菜单的主要功能 (1)输入若干条记录 (2)显示所有记录 (3)按学号排序 (4)插入一条记录 (5)按姓名查找,删除一条记录 (6)查找并显示一条记录 (7)输出统计信息 (新增)...

陇县15021975785: c语言设计学生成绩管理系统 -
鱼炭扶严: #include<iostream> #include<cstdio> #include<cmath> #include<vector> #include<list> #include<cstring> #include<map> #include<set> #include<algorithm> #include<queue> using namespace std; int n; struct birth {int year,month,day; };struct ...

陇县15021975785: c语言编写学生成绩管理系统 -
鱼炭扶严: #include <stdio.h> void main() { /*输入资料*/ int student[5][4],i; for (i=0; i<=4; i++); scanf("%d,%d,%d \n",student[i][0],student[i][1],student[i][2],student[i][3]) /*平均分*/ for (i=0; i<=4; i++); printf("%f",(float)((student[i][1]+student[i][2]+student[i][3]...

陇县15021975785: 求一个学生成绩管理系统的C语言代码!!急!! -
鱼炭扶严: #includestruct student { char num[10];char name[20];char sex[5];float grade[7];float v;float sum;}stu[50]; int k=0;void input(); void output(); void search(); void average(); void sort(); void save(); void main() { int a;do{printf("\n\n **************...

陇县15021975785: C语言:学生成绩管理系统 -
鱼炭扶严: /*该源码包括11个函数(包含main函数)①student_new②student_del③student_edit④score_input⑤score_edit⑥browser⑦page_title(main函数调用)⑧return_confirm(前五个函数调用)⑨search_id(第2/3/5个函数调用)⑩sort_it(browser函数调...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网