#include <stdio.h>
struct student
{
int math;
int english;
};
main()
{
student st;
printf("input math score:");
scanf("%d",&st.math);
printf("input english score:");
scanf("%d",&st.english);
printf("the score averave is:%d\n",(st.math+st.english)/2);
}
#include<stdio.h>
#define N 5
struct student
{
int snum;
char sname[10];
int slet1;
int slet2;
int slet3;
};
void input(int num,char name[10],int let1,int let2,int let3)
{
student newst;
newst.snum=num;
newst.sname[10]=name[10];
newst.slet1=let1;
newst.slet2=let2;
newst.slet3=let3;
}
main()
{
student sts[N];
for(int i=0;i<N;i++)
{
printf("input the NO.% dstudnet's data:",i+1);
scanf("%d %s %d %d %d",&sts[i].snum,&sts[i].sname,&sts[i].slet1,&sts[i].slet2,&sts[i].slet3);
}
for(int i=0;i<N;i++)
{
printf("%d %s %d %d %d\n",sts[i].snum,sts[i].sname,sts[i].slet1,sts[i].slet2,sts[i].slet3);
}
}
#include <stdio.h>
#define N 10
struct student
{
int num;
char name[10];
int math;
int english;
int computer;
int ave;
};
main()
{
student sts[N];
int maxave=0;
for(int i=0;i<N;i++)
{
printf("student%d:",i+1);
scanf("%d %s %d %d %d",&sts[i].num,&sts[i].name,&sts[i].math,&sts[i].english,&sts[i].computer);
sts[i].ave=(sts[i].math+sts[i].english+sts[i].computer)/3;
}
for(int i=0;i<N;i++)
{
if(maxave<sts[i].ave)
maxave=sts[i].ave;
}
for(int i=0;i<N;i++)
{
if(maxave==sts[i].ave)
printf("%d %s %d %d %d average score is:%d\n",sts[i].num,sts[i].name,sts[i].math,sts[i].english,sts[i].computer,sts[i].ave);
}
}