#include
#include
Int Max (int n, int * p) {
Int a=* p, I;
for(i=0; i
}
Int min (int n, int * p) {////
Int b=* p, I;
for(i=0; i
return b;
}
Int main ()
{
The FILE * fp, * ft=NULL;
Int sum=0, n=0, I=0, score [80].
Float aver.
Char s [80], * p, ch.//create the file name without the suffix
If ((fp=fopen (" score. TXT ", "r"))==NULL) {
Printf (" the File open error!" );
exit(0);//& lt; stdlib.h>
}
while(! The feof (fp)) {
P=s;
Fscanf (fp, "% s", p);
Score [I]=[0] - '0' (s) * 10 + s [1] - '0';
The sum +=score [I];
i++; n++;
}
If (fclose (fp)) {
Printf (" can you close the file?" );
exit(0);
}
Aver=1.0 * sum/n.
If ((ft=fopen (" result. TXT ", "w"))==NULL) {
Printf (" the file open error!" );
exit(0);//& lt; stdlib.h>
}
Fprintf (ft, "% 2 f", aver);
Fprintf (ft, "% d % d", Max (n, score), min (n, score));
If (fclose (ft)) {
Printf (" can you close the file?" );
exit(0);
}
return 0;
}
I ask questions in class group, nobody reason I, how to do, can only help you a great god! Have pity on me!
CodePudding user response:
It is ok to restartCodePudding user response:
CodePudding user response:
Didn't end should be compiled, the file is read and cannot be modified (guess)