用vector配合string进行存储,函数指针pfun根据flag值指向对应的比较函数,排序后输出。
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
struct student {
string num;
string name;
int score = 0;
};
vector<student>v;
bool num(const student a, const student b) {
if (a.num > b.num) return false