注意输入数据时的形式。#include<stdio.h>struct person{int xuehao;char name[20];char sex;int year;int grade;}man[80];main(){int n,i,max,k=0;printf("一共有多少学生;");scanf("%d",&n);for(i=0;i<n;i++){scanf("%d,%d,%d,",&man[i].xuehao,&man[i].year,&man[i].grade);scanf("%c,%s",&man[i].sex,&man[i].name);}max=man[0].grade;for(i=0;i<n;i++)if(max<man[i].grade){max=man[i].grade;k=i;}printf("name sex xuehao year grade\n");printf("--------------------------------------------------\n");for(i=0;i<n;i++)printf("%-12s%-4c%4d%8d%10d\n",man[i].name,man[i].sex,man[i].xuehao,man[i].year,man[i].grade);printf("最高分的学生信息:\n");printf("name sex xuehao year grade\n");printf("--------------------------------------------------\n");printf("%-12s%-4c%4d%8d%10d\n",man[k].name,man
发布于 2019-05-07 20:30