A class has no more than 30 people ( The specific number of people is input by keyboard ) Take an exam for a course , Programming to achieve the following student performance management :
(1) Enter the student number and examination results of each student ;
(2) Calculate the total and average score of the course ;
(3) Rank according to the grade from high to low ;
(4) According to the student number from small to large out of the grade table ;
(5) Query student ranking and examination results by student number ;
(6) According to excellent (90-100), good (80-89), secondary (70-79), pass (60-69), fail, (0-59)5 Categories , Count the number and percentage of people in each category ;
(7) Output the student number of each student , Examination results , And the total and average score of the course .

Input format :
( 1 ) Enter the number of students :
The input data format is required to be :"%d"
The prompt message is :“Input student number(n<30):\n”
( 2 ) Enter the student number and examination results of each student :
The input data format is required to be :"%ld%f"
The prompt message is :“Input student’s ID and score:\n”

Output format :

1, Output display of menu items :
Management for Students’ scores
1.Input record
2.Calculate total and average score of course
3.Sort in descending order by score
4.Sort in ascending order by number
5.Search by number
6.Statistic analysis
7.List record
0.Exit
Please Input your choice:

2, Calculate the total and average score of the course :
The format of output total score and average score is :“sum=%.0f,aver=%.2f\n”
3, Rank according to the grade from high to low :
The output format is required to be :"%ld\t%.0f\n"
The prompt message is :“Sort in descending order by score:\n”
4, According to the student number from small to large out of the grade table :
The output format is required to be :"%ld\t%.0f\n"
The prompt message is :“Sort in ascending order by number:\n”
5, Query student information and examination results by student number ( Output student number and grade ):
If the student with this student number is not found , The prompt message is :“Not found!\n”;
If the student is found , The output format is required to be :"%ld\t%.0f\n"
6, According to excellent (90-100), good (80-89), secondary (70-79), pass (60-69), fail, (0-59)5 Categories , Count the number and percentage of people in each category :
achievement <60 The output prompt format is :"<60\t%d\t%.2f%%\n";
achievement =100 The output format is :"%d\t%d\t%.2f%%\n";
Other required output percentage format is :"%d-%d\t%d\t%.2f%%\n"

Demonstration effect :

#include<stdio.h> #include<stdlib.h> #include<conio.h> // Macro defines the maximum number of students #define
stu_max 30 /* Make a global declaration of the function */ // Get the number of students int stu_num(); // Display menu to get user input char menu_tips();
// Get student ID , And our examination results void stu_information(long num[],float score[],int n);
// Calculate the total score and average score of the output course void sum_aver(float score[],int n); // Module function : Exchange two long integer data void
exchange_long(long *a,long *b); // Module function : Exchange two floating point data void exchange_float(float *a,
float *b); // Output ranking table from high to low void output_score(long num[],float score[],int n);
// According to the student number from small to large out of the grade table void output_num(long num[],float score[],int n); // Query and output student information and test results :
void query(long num[],float score[],int n); // Score delimitation processing and output void score_pro(float
score[],int n); // Output corresponding list directly void output(long num[],float score[],int n); // Pause screen clearing
void clean(); int main() { int n,i; long num[stu_max]; float score[stu_max]; n=
stu_num(); while(1) { i=menu_tips(); switch(i) { case '1':printf("1"),
stu_information(num,score,n),system("cls");break; case '2':printf("2"),sum_aver(
score,n),clean();break; case '3':printf("3"),output_score(num,score,n),clean();
break; case '4':printf("4"),output_num(num,score,n),clean();break; case '5':
printf("5"),query(num,score,n),clean();break; case '6':printf("6"),score_pro(
score,n),clean();break; case '7':printf("7"),output(num,score,n),clean();break;
case '0':printf("0"),exit(0);break; default:printf("Input error!\n"),clean(); }
} } /* The following is the function module */ // Get the number of students int stu_num() { int n; printf("Input student
number(n<30):\n"); scanf("%d",&n); system("cls"); return n; } // Display menu to get user input char
menu_tips() { printf("
-----------------------------------------------------------\n"); printf("|
Management for Students' scores |\n"); printf("
-----------------------------------------------------------\n"); printf("|
1.Input record |\n"); printf("| 2.Calculate total and average score of course
|\n"); printf("| 3.Sort in descending order by score |\n"); printf("| 4.Sort in
ascending order by numbe |\n"); printf("| 5.Search by number |\n"); printf("|
6.Statistic analysis |\n"); printf("| 7.List record |\n"); printf("| 0.Exit |\n"
); printf(" -----------------------------------------------------------\n");
printf("\nPlease Input your choice:\n"); char i; i=getch(); return i; }
// Get student ID , And our examination results void stu_information(long num[],float score[],int n) { int i;
printf("\nInput student's ID and score:\n"); for(i=0;i<n;i++) scanf("%ld%f",&num
[i],&score[i]); } // Calculate the total score and average score of the output course void sum_aver(float score[],int n) { int i;
float sum,aver; for(i=0,sum=0;i<n;i++) sum+=score[i]; aver=sum/n; printf(
"\nsum=%.0f,aver=%.2f\n",sum,aver); } // Module function : Exchange two long integer data void exchange_long(long *
a,long *b) { long t; t=*a; *a=*b; *b=t; } // Module function : Exchange two floating point data void exchange_float(
float *a,float *b) { float t; t=*a; *a=*b; *b=t; } // Output ranking table from high to low void
output_score(long num[],float score[],int n) { int i,j; for(j=n-1;j>0;j--) { for
(i=0;i<j;i++) if(score[i]<score[i+1]) { exchange_float(&score[i],&score[i+1]);
exchange_long(&num[i],&num[i+1]); } } printf("\nSort in descending order by
score:"); output(num,score,n); } // According to the student number from small to large out of the grade table void output_num(long num[],float
score[],int n) { int i,j; for(j=n-1;j>0;j--) { for(i=0;i<j;i++) if(num[i]>num[i
+1]) { exchange_float(&score[i],&score[i+1]); exchange_long(&num[i],&num[i+1]);
} } output(num,score,n); } // Query and output student information and test results : void query(long num[],float score[],
int n) { printf("\nEnter the ID to query:\n"); long temp; scanf("%ld",&temp);
int i; for(i=0;i<n;i++) { if(num[i]==temp) { printf("%ld\t%.0f\n",num[i],score[i
]); return; } } printf("\nNot found!\n"); } // Score delimitation processing and output void score_pro(float
score[],int n) { int t[6]={0,0,0,0,0,0}; /* The first five correspond to excellence respectively , good , secondary , pass , Five categories of failure
Sixth bit storage 100 Number of points */ int i,m; for(i=0;i<n;i++) { if(score[i]>=90&&score[i]<100) t[0]++
; if(score[i]>=80&&score[i]<=89) t[1]++; if(score[i]>=70&&score[i]<=79) t[2]++;
if(score[i]>=60&&score[i]<=69) t[3]++; if(score[i]>=0 &&score[i]<=59) t[4]++; if
(score[i]==100) t[5]++; } // ergodic t array , Output corresponding data for(i=0,m=9;i<6;i++) { if(i==4) printf
("<60\t%d\t%.2f%%\n",t[4],(float)t[4]/n*100); if(i==5) printf("%d\t%d\t%.2f%%\n"
,100,t[5],(float)t[5]/n*100); if(i!=4&&i!=5) { if(i==0) printf("\n"); printf(
"%d-%d\t%d\t%.2f%%\n",m*10,m*10+9,t[i],(float)t[i]/n*100); m--; } } } // Output corresponding list directly
void output(long num[],float score[],int n) { int i; for(i=0;i<n;i++) { if(i==0)
printf("\n"); printf("%ld\t%.0f\n",num[i],score[i]); } } // Pause screen clearing void clean() {
system("pause"); system("cls"); }

Technology
©2020 ioDraw All rights reserved
Java exercises 1: Simply define a car class New photo album app launched by Microsoft : Using cross platform framework React Native to write Chapter two Fundamentals of programming Programming exercises pandas Time order of webpack Code segmentation import()Vue slot slot: Default slot , Named slot , Scope slot Fundamentals of data analysis ——R language ( Processing missing values )C++ Implementation of matrix meteor shower effect PostMan Advanced Usage , Interface MD5+Secret autograph Sign The 12th Blue Bridge Cup B group C/C++ Provincial competition