C language student achievement management system source code

  • 2020-06-03 07:45:28
  • OfStack

C Language training course, C Language student achievement management system, for your reference, the specific content is as follows


#include<stdio.h> 
#include<string.h> 
#include<math.h> 
struct student 
 { 
 int num; 
 char name[20]; 
 float pingshi; 
 float shiyan; 
 float kaoshi; 
 double zongping; 
 }stu[4]; 
void main() 
{ 
 void a(); 
 void b(); 
 void c(); 
 void d(); 
 void e(); 
 int n; 
 while(n!=6) 
 { printf("\t University computer basic grade management system \n"); 
 printf("1 Input: 1 Basic computer scores of students in one class \n"); 
 printf("2 : Displays all achievement records \n"); 
 printf("3 : Calculate and output the mean score, mean square error \n"); 
 printf("4 : Output grades and rankings \n"); 
 printf("5 : The result is stored in the file chengji.txt\n"); 
 printf("6 : Quit the system \n"); 
 printf(" Enter option code :"); 
 scanf("%d",&n); 
 switch(n) 
 { 
 case 1:a();break; 
 case 2:b();break; 
 case 3:c();break; 
 case 4:d();break; 
 case 5:e();break; 
 case 6:printf("\n******************* Thanks for using! *******************\n");break; 
 break; 
 } 
 } 
getchar(); 
} 
/*  The child   letter   The number */ 
void a() /*  The input 1 Student records of each class */ 
 
{ 
 int i; 
 
 for(i=0;i<4;i++) 
 
 { 
 
 printf(" Please enter your student number   The name   grades   The experimental results   Examination results: "); 
 
 scanf("%d%s%f%f%f",&stu[i].num,stu[i].name,&stu[i].pingshi,&stu[i].shiyan,&stu[i].kaoshi); 
 
 }for(i=0;i<4;i++) 
stu[i].zongping=0.1*stu[i].pingshi+0.3*stu[i].shiyan+0.6*stu[i].kaoshi; 
} 
void b()/*  Display all records */ 
 
{ 
 int i; 
 
 printf(" Student id   The name   grades   The experimental results   Test scores   Overall performance \n"); 
 
 for(i=0;i<4;i++) 
 
 printf("%d%14.2s%14.2f%14.2f%14.2f%14.2f\n",stu[i].num,stu[i].name,stu[i].pingshi,stu[i].shiyan,stu[i].kaoshi,stu[i].zongping); 
 
} 
 
void c()/*  Figure out the class average and show the mean square error */ 
{ 
 int a[4]={0,1,2,3}; 
 int i,j; 
 double total=0,pfc=0,bzc=0; 
 double ave; 
 for(i=0;i<4;i++) 
 { 
 total=total+stu[i].zongping; 
 } 
 ave=total/4.0; 
 printf(" The overall average score is %f\n",ave); 
 for(i=0;i<4;i++) 
 { 
 pfc=pow((stu[i].zongping-ave),2)/4; 
 } 
 bzc=sqrt(pfc); 
 printf("\n (yi - (mxi + b)) is %f\n",pfc); 
 printf("\n The standard deviation is %f\n",bzc); 
} 
void d() 
 
{ 
 int a[4]={0,1,2,3}; 
 int i,j,temp; 
 for(j=0;j<3;j++) 
 { 
 for(i=0;i<3-j;i++) 
 if(stu[a[i]].zongping>stu[a[i+1]].zongping) 
 { 
 temp=a[i];a[i]=a[i+1]; 
 a[i+1]=temp; 
 
 } 
 } 
 
 printf(" The order :\n"); 
 
 printf(" Student id   The name   Overall performance \n"); 
 
 for(i=0;i<4;i++) 
 
 printf("%d%10.2s%15.2f\n",stu[a[i]].num,stu[a[i]].name,stu[a[i]].zongping); 
 
 printf("\n"); 
 
} 
 
void e() 
{int i; 
FILE *fp; 
fp=fopen("chengji.txt","w"); 
 
 fprintf(fp," Student id   The name   grades   The experimental results   Test scores   Overall performance \n"); 
 
 for(i=0;i<4;i++) 
 
 fprintf(fp,"%d%14.2s%14.2f%14.2f%14.2f%14.2f\n",stu[i].num,stu[i].name,stu[i].pingshi,stu[i].shiyan,stu[i].kaoshi,stu[i].zongping); 
 
printf("\n\n******************* Congratulations, save complete! *******************\n\n"); 
} 

Simple recording.

For more information, please pay attention to the topic management System Development.


Related articles: