#include<stdio.h>
#include<string.h>
struct book{
char name[31];
double price;
};
int main(void){
int n,i,j,k1,k2;
double min,max;
scanf("%d",&n);
struct book b[n];
for(i=0;i<n;i++){
for(j=0;j<31;j++){
b[i].name[j]=getchar();
if(b[i].name[j]=='\n'){
b[i].name[j]='0';
break;
}
}
scanf("%d",&b[i].price);
}
for(i=0;k1=0;max=b[0].price)
if(b[i].price>max){
k1=i;
max=b[i].price;
}
for(i=0;k2=0;min=b[0].price)
if(b[i].price<max){
k2=i;
min=b[i].price;
}
printf("%.2lf,",max);
for(j=0;j<31;j++)
printf("%c",b[k1].name[j]);
printf("\n");
printf("%.2lf,",min);
for(j=0;j<31;j++)
printf("%c",b[k2].name[j]);
return 0;
}
求助该程序哪错了