第二次编程总结
#include<stdlib.h>
int main(void)
{
FILE * fp;
int i,m,n;
int a[5];
if((fp=fopen("C:\\ha\\ha.txt","r+"))==NULL){
printf("File open error!\n");
exit(0);
}
for(i=0;i<5;i++)
{
fscanf(fp,"%d",&a[i]);
}
m=a[0];
for(i=0;i<5;i++) {
if(m<a[i])
m=a[i];
n=i;
}
fprintf(fp,"\n%d %d",m,n);
if(fclose(fp)){
printf("Can not close the file!\n");
exit(0);
}
return 0;
(2)
(3)