赞
踩
#include<stdio.h>
#include<string.h>
struct book{
char name[31];
double price;
};
int main(){
struct book b[20]
int n,i,j,count=0,cont=0;
double min=100,max=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("\n");
gets(b[i].name);
scanf("%lf",&b[i].price);
if(b[i].price>max){
max=b[i].price;
count=i;
}
if(b[i].price<min){
min=b[i].price;
cont=i;
}
}
printf("%.2f, %s\n",b[count].price,b[count].name);
printf("%.2f, %s\n",b[cont].price,b[cont].name);
return 0;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。