#include <stdio.h>
#define Maxsize 100
int main(){
FILE *f;
f=fopen("data.txt","r");
float a[Maxsize];
int i=0;
char ch;
int n;
while(fscanf(f,"%f",&a[i])!=EOF){
i++;
fscanf(f,"%c",&ch);
}
n=i;
float max1,max2;
if(a[0]>a[1]){
max1=a[0];
max2=a[1];
}
else{
max1=a[1];
max2=a[0];
}
for(i=0;i<n;i++){
if(a[i]>max1){
max2=max1;
max1=a[i];
}
else if(a[i]>max2){
max2=a[i];
}
}
printf("%.2f",max2);
fclose(f);
return 0;
}
04-24
513
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)