#include<stdio.h>
#define N 10
struct student {
char stuNum[20];
int math;
int c;
};
void input(struct student *p,int n){
int i;
for(i=0;i<n;i++){
printf("plesae input the %d stuNun:",i+1);
scanf("%s",p[i].stuNum);
printf("Please input the %d math:",i+1);
scanf("%d",&p[i].math);
//注意此处对int输入要取地址&
printf("Please input the %d c:",i+1);
scanf("%d",&p[i].c);
getchar();//去除残留回车符
}
}
int main()
{
int m=0,i,maxScore=0;
struct student stu[N],max[N];
printf("please input student information:\n");
input(stu,N);
for(i=0;i<N;i++)
{
if(stu[i].c > maxScore)
{
maxScore=stu[i].c;
}
}
for(i=0;i<N;i++)
{
if(stu[i].c==maxScore){
max[m++]=stu[i];
}
}
printf("Last:\n");
printf("the best c has %d\n",m);
while(m-->0){
printf("%s,%d,%d\n",stu[m].stuNum,stu[m].math,stu[m].c);
}
return 0;
}