各位高手帮帮忙!编程

来源:百度知道 编辑:UC知道 时间:2024/09/21 11:00:23
学生成绩管理问题。
有5个学生,每个学生有如下数据成员:姓名name[20]、(英语、数学、计算机)三门课的成绩score[3]、三门课的平均分ave。要求输入5个学生的相关数据并计算平均分,同时输出平均分大于等于60分的学生的所有信息,以及平均成绩最高的学生姓名。

c++写的,调试通过。
#include<iostream.h>
struct student
{
char name[20];
float score[3];
float ave;
};
void main()
{
student stu[5];
for(int i=0;i<5;i++)
{
cout<<endl<<"输入第"<<i+1<<"个学生的姓名:";
cin>>stu[i].name;
cout<<endl<<"输入第" <<i+1<<"个学生的英语成绩:";
cin>>stu[i].score[0];
cout<<endl<<"输入第" <<i+1<<"个学生的数学成绩:";
cin>>stu[i].score[1];
cout<<endl<<"输入第" <<i+1<<"个学生的计算机成绩:";
cin>>stu[i].score[2];
stu[i].ave=(stu[i].score[0]+stu[i].score[1]+stu[i].score[2])/3;
}
int j,temp_un;
float temp;
for(j=0;j<5;j++)
{
temp=stu[0].ave;
temp_un=0;
if(stu[j].ave>temp)
{
temp=stu[j].ave;
temp_un=j;