帮我看看下面的程序有什么问题啊 有什么建议尽管提 #include <iostream.h> #include <stdio.h> #include <string.h> #define N 3 class student { int english,computer,no; public: int total; void getscore(int n,int e,int c) { no=n; english=e; computer=c; total = english + computer; }
void display() { cout<<"学号:"<<no<<'\n'; cout<<"英语成绩:"<<english<<'\n'; cout<<"计算机成绩:"<<computer<<'\n'; cout<<"总分:"<<total<<'\n'; }
void sort(student *) { student temp,s[N]; int i; for (i=0;i<N;i++) { if ( s[i].total<s[i+1].total) { temp=s[i];s[i]=s[i+1];s[i+1]=temp; } } } }; void main() { student st[N]; int i,n,c,e; for(i=0;i<N;i++) { cout<<"输入学号:"<<'\n'; cin>>n; cout<<"输入英语成绩:"<<'\n'; cin>>e; cout<<"输入计算机成绩:"<<'\n'; cin>>c;
st[i].getscore(n,e,c); } for(i=0;i<N;i++) { st[i].display(); }
st[N].sort;
for(i=0;i<N;i++) { st[i].display(); } }