# include & ltstdio.h & gt
# include & ltconio.h & gt
# include & ltstdlib.h & gt
# include & ltstring.h & gt
# Define a maximum of 80
Void input ();
void sort();
Void display ();
void insert();
void del();
Void average ();
void find(); ;
void read(); ;
Void average ();
void modify();
int now _ no = 0;
Structural students
{
Int number;
char name[20];
char sex[4];
float score 1;
Floating score 2;
Floating score 3;
Floating-point sorting;
Floating street;
Floating sum;
};
Voidhaverage ()/* Average */
{
int I;
for(I = 0; I< _ don't; i++)
{
Stu [me]. sum = stu[I]. score 1+stu[I]. score 2+stu[I]. score 3;
Stu [me]. ave=stu[i]。 sum/3;
}
}
Struct student stu[MAX], * p;;
Main()/* main function */
{
int as
Start:printf(" \ n \ t \ t \ t tWelcome to the student achievement management system \ n ");
/* Next is the function selection module */
do
{
Printf ("\n \ t \ t \ t 1。 Enter student information \ n \ t \ t \ t2. Show student information \ n \ t \ t \ t3. Classification information \ n \ t \ t \.
Printf ("\ t \ t \ t \ tSelect function option: ");
fflush(stdin);
scanf("%d ",& ampas);
Switch (component)
{
Case 1: System ("CLS"); input(); Break;
Case 2: System ("CLS"); Display (); Break;
Case 3: System ("CLS"); sort(); Break;
Case 4: System ("CLS"); insert(); Break;
Case 5: System ("CLS"); del(); Break;
Case 6: System ("CLS"); modify(); Break;
Case 7: System ("CLS"); find(); Break; ;
Case 8: System ("Exit"); Exit (0);
Default value: system ("CLS"); Go to the beginning;
}
} while( 1);
/* This is the end of function selection */
}
Void input()/* Raw data input module */
{
int I = 0;
char ch
do
{
Printf ("\ t \ t \ t 1。 Enter student information \nEnter information of %d students \ n ",i+1);
Printf ("\ nEnter student number:");
Scanf("%d ",& Stu [me]. No);
fflush(stdin);
Printf ("\ nEnter student name:");
fflush(stdin);
Get (stu[i]. Name);
Printf ("\ nEnter student gender:");
fflush(stdin);
Get (stu[i]. Sex);
Printf ("\ nEnter student grades1:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 1);
Printf ("\ nEnter student grade 2:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 2);
Printf ("\ nEnter the third grade of students:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 3);
printf(" \ n \ n ");
i++;
now _ no = I;
Printf ("Do you want to continue typing? (Y/N)");
fflush(stdin);
ch = getch();
System ("CLS");
}
And (ch! = ' n ' & amp& ampch! = ' N ');
System ("CLS");
}
Void sort()/* Sort data function */
{
Structural student temperature;
int i,j;
Average value ();
for(I = 1; I< _ don't; i++)
{
for(j = 1; j & lt= now _ no-I; j++)
{
if(stu[j- 1]。 Ave< Stu [j]. ave)
{
temp = stu[j];
stu[j]= stu[j- 1];
stu[j- 1]= temp;
}
}
}
}
Void display()/* Display data function */
{
int I;
char as
Average value ();
do
{
Printf ("\ t \ t \ tClass information list \ n");
Printf ("\ tNo .. \ tName \ tSex \ ts core 1 \ ts core 2 \ ts core 3 \ t average \ n ");
for(I = 0; I< now _ no & Stu [me]. Name [0]; I++) printf ("\ t% d \ t% s \ t% s \ t% .2f \ t% .2f \ n", stu[i]. No, Stu [I]. Name, Stu [me]. Sex, Stu [I]. Score 1, Stu [I]. Score 2, Stu [I]. Score 3, Stu [I]. ave);
Printf ("\ t \ tPress any key to return to the main menu. );
fflush(stdin);
as = getch();
}
And (! as);
System ("CLS");
}
Void insert()/* Insert data function */
{
char ch
do
{
Printf(" \ n \ t \ t tEnter the information of the newly inserted student team \ n ");
Printf ("\ nEnter student number:");
Scanf("%d ",& Stu [now _ none]. No);
fflush(stdin);
Printf ("\ nEnter student name:");
fflush(stdin);
Get (stu[now_no]. Name);
Printf ("\ nEnter student gender:");
fflush(stdin);
Get (stu[now_no]. Sex);
Printf ("\ nEnter student grades1:");
fflush(stdin);
scanf("%f ",& ampstu[now _ no]. score 1);
Printf ("\ nEnter student grade 2:");
fflush(stdin);
scanf("%f ",& ampstu[now _ no]. score 2);
Printf ("\ nEnter the third grade of students:");
fflush(stdin);
scanf("%f ",& ampstu[now _ no]. score 3);
printf(" \ n \ n ");
Now _ No = now _ No+1;
sort();
Printf ("Do you want to continue typing? (Y/N)");
fflush(stdin);
ch = getch();
System ("CLS");
}
And (ch! = ' n ' & amp& ampch! = ' N ');
}
Void del()/* Delete data function */
{
int inum,I,j;
Printf ("Enter the student number to be deleted:");
fflush(stdin);
scanf("%d ",& ampinum);
for(I = 0; I< _ don't; i++)
{
If (Stu [I]. no==inum)
{
if(I = = now _ no)now _ no-= 1;
other
{
stu[I]= stu[now _ no- 1];
now _ no-= 1;
}
sort();
Break;
}
}
System ("CLS");
}
Void find()/* Query function */
{
int I;
char string[20],as;
do
{
Printf ("Enter the name of the student to be queried:");
fflush(stdin);
gets(str);
for(I = 0; I< _ don't; i++)
If (! Strcmp(stu[i]. Name, string))
{
Printf ("\ tNo .. \ tName \ tSex \ ts core 1 \ ts core 2 \ ts core 3 \ t average \ n ");
printf(" \ t % d \ t % s \ t % s \ t % . 2f \ t % . 2f \ t % . 2f \ t % . 2f \ n ",stu[i]。 No, Stu [me]. Name, Stu [me]. Sex, Stu [I]. Score 1, Stu [I]. Score 2, Stu [I]. Score 3, Stu [I]. ave);
}
Printf ("\ t \ tPress any key to return to the main menu. );
fflush(stdin);
as = getch();
}
And (! as);
System ("CLS");
}
Void modify()/* Modify data function */
{
int I;
char string[20],as;
Printf ("Enter the name of the student to be modified:");
fflush(stdin);
gets(str);
for(I = 0; I< _ don't; i++)
If (! Strcmp(stu[i]. Name, string))
{
System ("CLS");
Printf(" \ n \ t \ t tEnter and modify student information \ n ");
Printf ("\ nEnter student number:");
fflush(stdin);
Scanf("%d ",& Stu [me]. No);
Printf ("\ nEnter student gender:");
fflush(stdin);
Get (stu[i]. Sex);
Printf ("\ nEnter student grades1:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 1);
Printf ("\ nEnter student grade 2:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 2);
Printf ("\ nEnter the third grade of students:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 3);
printf(" \ n \ n ");
sort();
Break;
}
System ("CLS");
}