结果编译出问题。。。我不知道怎么改
程序代码:
#include <iostream> using namespace std; class student { public: student(int n,string nam,float s):num(n),name(nam),score(s){} private: int a[5]; char num; string name; float score; void set() {student a[5]; int i,j=0,k=0; cout<<"请输入学生1的学号:"; cin>>a[0].num; cout<<"请输入学生1的姓名:"; cin>>a[0].name; cout<<"请输入学生1的成绩:"; cin>>a[0].score;} int main() { double sun=a[0].score,max=a[0].score,min=a[0].score; for(i=1;i<N;i++) { cout<<"请输入学生"<<i+1<<"的学号:"; cin>>a[i].num; cout<<"请输入学生"<<i+1<<"的姓名:"; cin>>a[i].name; cout<<"请输入学生"<<i+1<<"的成绩:"; cin>>a[i].score; sum+=a[i].score; if(a[i].score>max) { max=a[i].score; j=i; } if(a[i].score<min) { min=a[i].score; k=i; } } cout<<"平均分:"<<"ave="<<sum/3<<endl; cout<<"最高分学号:"<<a[j].num<<"最高分姓名:"<<a[j].name<<"最高分分数:"<<a[j].score<<endl; cout<<"最高分学号:"<<a[k].num<<"最低分姓名:"<<a[k].name<<"最低分分数:"<<a[k].score<<endl; return 0; }