Home > Back-end >  C language programming, documents related, such as modify the program after the program compiled, di
C language programming, documents related, such as modify the program after the program compiled, di

Time:09-19

Like this!


 

#include
#include
Int Max (int n, int * p) {
Int a=* p, I;
for(i=0; iIf (areturn a;
}
Int min (int n, int * p) {////
Int b=* p, I;
for(i=0; iIf (b> B=* p * p);
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 restart

CodePudding user response:

CodePudding user response:

Didn't end should be compiled, the file is read and cannot be modified (guess)