Home > Back-end >  C language program: student achievement management system
C language program: student achievement management system

Time:12-24

Which bosses can help analyze the program and use of knowledge, to realize the related features of what
#include
#include
Struct Stu {
Int no;
int number;
Char sex [6].
char name[20];
int math;
Int eng;
Int score;
} [30] a={0};
Int Score () {
Struct Stu t;
Struct Stu b [30];
For (int k=1; k<=20; K++) {
B=[k] a [k].
}
int i,j;
for(i=1; i<=20; I++) {
If (b [I]. Score!=0) {
for(j=i+1; J<=20; J++) {
If (b [j]. Score!=0) {
If (b [I] score> B [j] score) {
T=b [I];
B=b [I] [j];
B [j]=t;
}
}
}
}
}
for(i=1; i<=20; I++) {
If (b [I] number!=0) {printf (" name, student id number: % d: % d % s mathematics: % d: % d grade: gender: % d % s \ n ", [I]. B no, b [I] number, b [I]. Name, b [I]. Math, b [I]. Eng, b [I] score, b [I] sex);
}
}
}
Int English () {
Struct Stu t;
Struct Stu b [30];
For (int k=1; k<=20; K++) {
B=[k] a [k].
}
int i,j;
for(i=1; i<=20; I++) {
If (b [I]. Eng.=0) {
for(j=i+1; J<=20; J++) {
If (b [j]. Eng.=0) {
If (b [I] eng> B [j]. Eng) {
T=b [I];
B=b [I] [j];
B [j]=t;
}
}
}
}
}

for(i=1; i<=20; I++) {
If (b [I] number!=0) {printf (" name, student id number: % d: % d % s mathematics: % d: % d grade: gender: % d % s \ n ", [I]. B no, b [I] number, b [I]. Name, b [I]. Math, b [I]. Eng, b [I] score, b [I] sex);
}
}
}
Int Math () {
Struct Stu t;
Struct Stu b [30];
For (int k=1; k<=20; K++) {
B=[k] a [k].
}
int i,j;
for(i=1; i<=20; I++) {
If (b [I]. Math!=0) {
for(j=i+1; J<=20; J++) {
If (b [j]. Journal of math!=0) {
If (b [I] math> B [j]. Journal of math) {
T=b [I];
B=b [I] [j];
B [j]=t;
}
}
}
}
}

for(i=1; i<=20; I++) {
If (b [I] number!=0) {printf (" name, student id number: % d: % d % s mathematics: % d: % d grade: gender: % d % s \ n ", [I]. B no, b [I] number, b [I]. Name, b [I]. Math, b [I]. Eng, b [I] score, b [I] sex);
}
}
}
Int the Sort () {
Int t;
Printf (" 1. According to the sorting in math \ n2. Sort by English \ n3 sort by grade \ n ");
The scanf (" % d ", & amp; T);
The switch (t) {
Case 1:
Math ();
break;
Case 2:
English ();
break;
Case 3:
Score ();
break;
Default: printf (" input error \ n ");
}
}
Int the Output () {//Output all existing data
for(int i=1; i<=20; I++) {
If (a [I] number!=0) {printf (" name, student id number: % d: % d % s mathematics: % d: % d grade: gender: % d % s \ n ", a [I] no, [I] a number, a [I]. Name, a [I]. Math, a [I]. Eng, a [I] score, a [I] sex);
}
}
}
Int Menu () {
Printf (" (1) add \ n (2) the delete \ n 3. Refer \ n 4. The output \ n 5. Sort \ n 6. End \ n ");
}
Int Refer () {//input serial number, output student id, name, grade and gender
int n;
Printf (" input query number \ n ");
The scanf (" % d ", & amp; N);
for(int i=1; i<=20; I++) {
If (a [I]. No==n& & [I] a number!=0) {
Name: student id: printf (" % d % s mathematics: English: % d % d grade: gender: % d % s \ n ", [n]. A number, a [n]. Name, a [n]. Math, a [n]. Eng, a [n]. Score, a [n]. Sex);
}
}
If (a [n]. Number==0) {
Printf (" data does not exist \ n ");
}


}
Int the Delete () {//input serial number, Delete student id, name, grade and gender
Int DE;
Printf (" input to delete the serial number \ n ");
The scanf (" % d ", & amp; DE);
If (a [DE] number!=0) {
A [DE] number=0;
A [DE]. Score=0;
A [DE]. Math=0;
A [DE]. Eng=0;
Printf (" delete successful \ n ");
}
The else printf (" data does not exist \ n ");

}
Int the Add () {//input serial number, student id, name, sex, grades and when to stop input serial number less than or equal to 0,
Printf (" input number. (number<20) \ n input serial number, student id, name, maths, English and sex, when stop input serial number less than or equal to 0, \ n ");
int i;
Do {
The scanf (" % d ", & amp; i);
If (i> 0 & amp; & A [I] number==0 & amp; & i<20)={
A [I]. No=I;
Printf (" number: ");
The scanf (" % d ", & amp; [I] a number);
Printf (" name: ");
The scanf (" % s ", & amp; A [I] name);
Printf (" Math: ");
The scanf (" % d ", & amp; A [I]. Math);
English: printf (" ");
The scanf (" % d ", & amp; A [I]. Eng);
Printf (" sex: ");
The scanf (" % s ", & amp; A [I] sex);
A [I]. Score=[I] a math + a [I]. Eng.
Printf (" input success \ n ");
}
Else if (a [I] number!=0) {
Printf (" data exist \ n ");
}
The else break;
}

While (i>=1);
}
Int main () {
Int nu;
Do {
The Menu ();
The scanf (" % d ", & amp; Nu);
If (nu> 0 & amp; & Nu<7) {
The switch (nu) {
Case 1: Add ();
break;
Case 2: the Delete ();
break;
Case 3: Refer ();
break;
Case 4: the Output ();
break;
Case 5: Sort ();
break;
Case 6:
break;
Default: printf (" input error \ n ");
}
}
The else printf (" input error \ n ");

getchar();
}
While (nu!=6);

}

CodePudding user response:

Mainly used in structure, array, sorting the knowledge points, you look at the menu options corresponding to the calling function which kind of knowledge will know that used
  • Related