c++学生成绩排序及选择输出

梦山高中现需要将某普通班的最优秀学生调整入理科实验班。为此,将从两个方面考察学生,一是数学和英语两门课的总分;另一个是所有四门课的总分。分别找出两科总分和全科总分的第一名,并从中决定调整人选。

输入将首先输入学生数n, (n为不超过80的正整数);接下来依次输入各位学生的学号,数学、英语、语文、理科综合成绩。学号及四科成绩均为不超过300的正整数。

输出时:第一行输出两科总分第一的学号,第二行输出四科总分第一的学号。 约定在两位学生成绩相同时,优先选择学号较小的学生;各位学生的学号均不相同。

裁判测试程序样例:

#include <iostream>
using namespace std;
const int N=80;
struct Student{
  int num;
  int score[4];
};

/* 请在这里填写答案 */

int main()
{
  int i, j, k, n;
  bool s2(const Student &, const Student &);
  bool s4(const Student &, const Student &);
  Student st[N];
   cin>>n;
   for(i=0;i<n;i++){
      cin>>st[i].num;
      for(j=0;j<4;j++) cin>>st[i].score[j];
    }
   cout<<select(st, n, s2)<<endl;
   cout<<select(st, n, s4)<<endl;
}


输入样例:
3
6 148 150 120 252
5 148 150 117 260
7 145 148 128 287
输出样例:
5
7

我的解答思路
  bool s2(const Student &, const Student &)
 {
 
    return true;

 }
 bool s4(const Student &, const Student &)
 {
 
     return false;

 }
 
int select(Student st[],int n ,bool s)
{   
   
    int i=0,max=0; 
    if(s==1)
      {
        for(i=0;i<n;i++)
        {
            st[i].score[2]=st[i].score[3]=0;
        }
      }
    for(i=1,max=0;i<n;i++)
      {
          if((st[max].score[0]+st[max].score[1]+st[max].score[2]+st[max].score[3])<(st[i].score[0]+st[i].score[1]+st[i].score[2]+st[i].score[3]))
          max=i;
           else if((st[max].score[0]+st[max].score[1]+st[max].score[2]+st[max].score[3])==(st[i].score[0]+st[i].score[1]+st[i].score[2]+st[i].score[3]))
           {
              if(st[max].num>st[i].num)max=i;else max=max;
              
          }
        else max=max;
      }
      return st[max].num;
}
 
 

这个思路对不对以及如何修改我的代码