第7段(1 / 3)

{

for(int m=0;m

stu[m].total=stu[m].math stu[m].english stu[m].computer;

for(m=0;m

cout<

}

float everyave(struct student stu[],int i)

{

float avemath=0;

float aveenglish=0;

float avecomputer=0;

float summath=0,sumenglish=0,sumcomputer=0;

for(int m=0;m

summath =stu[m].math;

sumenglish =stu[m].english;

sumcomputer =stu[m].computer;

}

avemath=summath/6;

aveenglish=sumenglish/6;

avecomputer=sumcomputer/6;

cout<<"數學課的平均成績是"<

cout<<"英語課的平均成績是"<

cout<<"計算機課的平均成績是"<

return avemath;

}

void overmath(struct student stu[],int i,float avemath)

{

int count=0;

cout<<"數學成績高於平均分的有:"<

for(int m=0;m

if(stu[m].math>avemath){

cout<

count ;

}

cout<<"共"<

}

void bubble(struct student stu[],int i)

{

struct student temp;

for(int a=1;a

for(int b=0;b

if(stu[b].total>stu[b 1].total){

temp=stu[b];

stu[b]=stu[b 1];

stu[b 1]=temp;

}

}

void addstudent(struct student stu[],int &i)

{

i ;

cout<<"姓名:";

cin>>stu[i-1].name;

cout<<"姓別M/F:";

cin>>stu[i-1].sex;

cout<<"專業:";