(1)实验代码
include<stdio.h>
include<stdlib.h>
int main() { FILE *fp; char sz[10]; int i,max=0,n;
if((fp=fopen("D:\sakura.txt","a+"))==NULL)
{
printf("找不到该文件
");
exit(0);
}
fscanf(fp,"%d",&n);
for(i=0;i<n;i++)
{
fscanf(fp,"%d ",&sz[i]);
}
for(i=0;i<n;i++)
{
if(sz [i] >sz [max])
max=i;
}
fprintf("
%d %d", sz [max],max);
if(fclose(fp)){
printf("文件关不了啊!
");
exit(0);
}
return 0;