Home > Back-end >  Please everybody to help to see why the input performance function has been wrong
Please everybody to help to see why the input performance function has been wrong

Time:09-17

#include
#include
#include
#include

Struct student
{
Int xh.
Char xm [30].
Float kc1;
Float kc2.
Float ventilation;
Float government;
};
Struct student cj [30].

Int main ()
{
Void CJSR ();
Void CJTJ ();
Void CJPX ();
Void CJCX ();


Int ch;
While (1)
{system (" CLS ");
Printf (" student achievement management system \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" 1 -- -- -- student achievement input \ n ");
Printf (" 2 - student performance statistics \ n ");
Printf (" 3 - student achievement sorting \ n ");
Printf (" 4 - student achievement inquiry \ n ");
Printf (" 0 - exit system \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" please select 0-4: ");
The scanf (" % d ", & amp; Ch);
The switch (ch)
{
Case 0: printf (" exit system! \n"); exit(0);
Case 1: CJSR (); break;
Case 2: CJTJ (); break;
Case 3: CJPX (); break;
Case 4: CJCX (); break;
Default: printf (" menu selection error! \n");
}
Printf (" press any key to continue... ");
}
}

Void CJSR ()
{
int i;

FILE *fp;
Fp=fopen (" cj. TXT ", "r");
for(i=0; I<10; I++)
{
Fscanf (fp, "% d % s % f % f % f", & amp; Cj [I]. Xh, cj [I] xm, & amp; Cj [I]. Kc1, & amp; Cj [I]. Kc2, & amp; Cj [I] ventilation);
}
fclose(fp);

Printf (" \ n of Chinese maths English student id name ");
for(i=0; I<=9; I++)
{
Printf (" % 3 d, "cj [I] xh);
Printf (" % s ", cj [I] xm);
Printf (" % 7.1 f ", cj [I] kc1);
Printf (" % 7.1 f ", cj [I] kc2);
Printf (" % 7.1 f ", cj [I] ventilation).

printf("\n");
}
}

Void CJTJ ()
{
Void XMTJ ();
Void KCTJ ();
Int ch;
While (1)
{system (" CLS ");
Printf (" student achievement statistics \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" 1 -- -- -- according to the students \ n ");
Printf (" 2 -- - according to the statistics course \ n ");
Printf (" 0 - exit statistics \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" please select 0-2: ");
The scanf (" % d ", & amp; Ch);
The switch (ch)
{
Case 0: printf (" exit statistics! \n"); return;
Case 1: XMTJ (); break;
Case 2: KCTJ (); break;
Default: printf (" menu selection error! \n");
}
Printf (" press any key to continue... ");
Getch ();
}
}
Void XMTJ ()
{
int i;
for(i=0; I<=9; I++)
Cj [I]. Zf=cj [I] kc1 + cj [I] kc2 + cj [I] ventilation;
Printf (" student id name Chinese maths English score \ n ");
for(i=0; I<=9; I++)
{
Printf (" % 3 d, "cj [I] xh);
Printf (" % s ", cj [I] xm);
Printf (" % 7.1 f ", cj [I] kc1);
Printf (" % 7.1 f ", cj [I] kc2);
Printf (" % 7.1 f ", cj [I] ventilation).
Printf (" % 7.1 f ", cj [I] zf);

printf("\n");
}
}

Void KCTJ ()
{
Float KCZF [3]={0};
int i;
for(i=0; I<=9; I++)
{
KCZF [0]=KCZF [0] + cj [I] kc1;
KCZF [1]=KCZF [1] + cj [I] kc2.
KCZF [2]=KCZF [2] + cj [I] ventilation;
}

Printf (" \ n of Chinese maths English ");
Printf (" total score: % 7.1 f % 7.1 f % 7.1 f ", KCZF [0], KCZF [1], KCZF [2]).
printf("\n");
}

Void CJPX ()
{
Void ZFPX ();
Void ywpx ();
Int ch;
While (1)
{system (" CLS ");
Printf (" student achievement sort \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" 1 -- -- -- according to the total order \ n ");
Printf (" 2 - language by \ n ");
Printf (" 0 - sort out \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" please select 0-2: ");
The scanf (" % d ", & amp; Ch);
The switch (ch)
{
Case 0: printf (" sort out! \n"); return;
Case 1: ZFPX (); break;
Case 2: ywpx (); break;
Default: printf (" menu selection error! \n");
}
Printf (" press any key to continue... ");
Getch ();
}
}

Void ZFPX ()
{
Struct student s;
int i,j;
for(i=0; I<=9; I++)
{
Cj [I]. Zf=cj [I] kc1 + cj [I] kc2 + cj [I] ventilation;
}
for(i=0; I<10; I++)
{
For (j=I; j<10; J++)
{
If (cj [I] zf{
S=cj [I];
Cj [I]=cj [j];
Cj [j]=s;
}
}
}
Printf (" student id name Chinese maths English score \ n ");
for(i=0; I<=9; I++)
{
Printf (" % 3 d, "cj [I] xh);
Printf (" % s ", cj [I] xm);
Printf (" % 7.1 f ", cj [I] kc1);
Printf (" % 7.1 f ", cj [I] kc2);
Printf (" % 7.1 f ", cj [I] ventilation).
Printf (" % 7.1 f ", cj [I] zf);

printf("\n");
}
}
Void ywpx ()
{
Struct student s;
int i,j;
for(i=0; I<10; I++)
{
For (j=I; j<10; J++)
{
If (cj [I] kc1 & lt; Cj [j]. Journal of kc1)
{
S=cj [I];
Cj [I]=cj [j];
Cj [j]=s;
}
}
}
Printf (" \ n of Chinese maths English student id name ");
for(i=0; I<=9; I++)
{
Printf (" % 3 d, "cj [I] xh);
Printf (" % s ", cj [I] xm);
Printf (" % 7.1 f ", cj [I] kc1);
Printf (" % 7.1 f ", cj [I] kc2);
Printf (" % 7.1 f ", cj [I] ventilation).

printf("\n");
}
}

Void CJCX ()
{
Void XHCX ();
Void XMCX ();
Int ch;
While (1)
{system (" CLS ");
Printf (" student achievement inquiry \ n ");
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related