#include<stdio.h>#include<stdlib.h>#define N 10int main(){ int i; struct student{ int num; char name[8]; char sex; int age; double grade;}; struct student stu[N]; struct student stumax,stumin; FILE *fp; fp=fopen("aa.txt","r"); if (fp==NULL) {printf("文本打开出错!"); exit(0); } for(i=0;i<N;i++) fscanf(fp,"%d %s %s %d %1f",&stu[i].num,&stu[i].name,&stu[i].sex,&stu[i].age,&stu[i].grade); stumax.grade=0;stumin.grade=100; for(i=0;i<N;i++) { if (stu[i].grade<=stumin.grade) stu[i]=stumin.grade; if (stu[i].grade>=stumax.grade) stu[i]=stumax.grade; } printf("最大值和最小值分别是\n",stumax,stumin); }