1. c语言编写最高分和最低分
#include<stdio.h>
#defineSTUDENT_COUNT40 //定义学生数目
intmain()
{
intstudent_score[STUDENT_COUNT],max_score=0,min_score=100;
srand(unsigned(time(NULL)));
for(inti=0;i<STUDENT_COUNT;i++)
{
scanf("%d",&student_score[i]);
}
for(inti=0;i<STUDENT_COUNT;i++)
{
if(max_score<student_score[i])
{
max_score=student_score[i];
}
if(min_score>student_score[i])
{
min_score=student_score[i];
}
}
printf("maxscore:%d,minscore:%d ",max_score,min_score);
return0;
}
//测试样例
//2
//4
//32
//91
//58
//67
//69
//31
//12
//88
//35
//40
//80
//87
//35
//61
//11
//67
//87
//67
//28
//70
//51
//8
//0
//50
//82
//25
//99
//74
//24
//48
//79
//85
//51
//13
//86
//19
//2
//41
//maxscore:99,minscore:0
2. C语言struct程序输出最高分
#include<stdio.h>
structstudent
{
intnum;
charname[10];
intscore;
}student[5],S;
voidmain()
{
inti;
printf("输入五个学生的学号,名字,成绩 ");
for(i=0;i<5;i++)
{
scanf("%d%s%d",&student[i].num,&student[i].name,&student[i].score);
}
S=student[0];
for(i=1;i<5;i++)
{
if(S.score<student[i].score)
S=student[i];
}
printf(" 第一名学生的信息:");
printf(" 学号:%d 姓名:%s 成绩:%d ",S.num,S.name,S.score);
}
这个程序不用取下标那么麻烦,定义结构体S就可以了
3. C语言编程 查找最高总分
#include<stdio.h>
#defineN5
intmain()
{
charstr[N][20]={'