#include
#include
using namespace std;
const int n=10;
struct student
{
char num[6];
char name[8];
int score[4];
}stu[n];
int main()
{
void print(student stu[]);
double average(student &stu);
student max(student stu[]);
int i,j;
for (i=0;i
cout<<"input scores of student "< cout<<"NO.: ";
cin>>stu[i].num;
cout<<"name: ";
cin>>stu[i].name;
for (j=0;j<3;j++)
{
cout<<"score "<
}
cout<
print(stu);
for (i=0;i
cout<<"stu["< }
student max_=max(stu); //获取最大值平均值的学生
//打印最高分学生数据
cout<<"the max student is: "<<"NO.:"<
{
cout<
cout<<" average: "<
}
void print(student stu[])
{
int i,j;
cout<<" NO. name score1 score2 score3"<
cout<
cout<
}
double average(student &stu)
{
return (stu.score[0]+stu.score[1]+stu.score[2])/3.0;
}
student max(student stu[])
{
double max=average(stu[0]);
int j=0;
for (int i=1;i
{
max=average(stu[i]);
j=i;
}
return stu[j];
}
按照你的思路编的,望采纳
第一题: #include "stdio.h" float *Grade(float *num,int i) //必须使用递归函数,否则扣掉20分。 8、编写函数Squeeze(char s[],char c),EyGGvT
为什么用结构体呢,用c++的class类多好啊。