这个程序怎么设计一个查找学生成绩
#include<iostream>#include<string>
using namespace std;
class Student
{ private:
int num;
char name[10];
char sex[4];
string kemu[10];
float score[10];
float aver;
public:
void show(int );
void input();
void fenshu(int);
void chazhao();
void xiugai();
void avery(int);
};
void Student::input ()
{
cout<<"输入姓名:"<<"\t";
cin>>name;
cout<<"输入学号:"<<"\t";
cin>>num;
cout<<"输入性别:"<<"\t";
cin>>sex;
}
void Student::show (int k)
{ int j;
cout<<"姓名"<<" "<<name<<"\t";
cout<<"学号"<<" "<<num<<"\t";
cout<<"性别"<<" "<<sex<<"\t";
cout<<"成绩"<<"\t";
for(j=0;j<k;j++)
{
cout<<kemu[j]<<"\t"<<score[j]<<"\t";
}
cout<<"平均成绩"<<aver<<"\t";
cout<<endl;
}
void Student::fenshu (int k)
{
cout<<"输入科目及分数:"<<endl;
cin>>kemu[k];
cin>>score[k];
}
void Student::avery (int k)
{ int j,
float a=0;
for(j=0;j<k;j++)
{
a=score[j]+a;
}
aver=a/k;
}
int m,n;
int main()
{ int i,j;
long int nu;
Student stud[100];
Student A;
cout<<"输入学生人数:";
cin>>n;
cout<<"输入学科数:";
cin>>m;
for(i=0;i<n;i++)
{
stud[i].input ();
for(j=0;j<m;j++)
{
stud[i].fenshu (j);
}
stud[i].avery (m);
}
for(i=0;i<n;i++)
{
stud[i].show (m);
}
return 0;
}