结构体简易使用,请问大神们学习结构体的有哪些方法和资料??
/*********************************************************************输入10个学生(包括姓名和成绩)的信息,找出成绩最高的,然后输出该学生的
姓名和成绩。
**********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct students{
char name[15];
int score;
};
int main(void)
{
struct students student[4];
int i,j,k,max = 0;
printf("please input students information:");
for(i = 0;i < 5;i++)
{
printf("please input shudent %d name:\n",i + 1);
scanf("%s",student[i].name);
printf("please input student %d score:\n",i + 1);
scanf("%d",&student[i].score);
}
for(j = 0;j < 5;j++)
{
if(student[j].score > max)
{
max = student[j].score;
k = j;
}
}
printf("find the best student,student[%d]\n",k + 1);
printf("the student name is %s\n",student[k].name);
printf("the student score is %d\n",student[k].score);
return 0;
}