![]() |
#2
rjsp2017-02-22 16:31
|

#include<iostream>
#include<set>
#include<string>
using namespace std;
bool com(const string &a, const string &b)
{
return a > b;
}
int main()
{
multiset<string,decltype(com)*> q(com);
string s;
while (cin >> s)
{
q.insert(s);
}
for (auto a : q)
{
cout << a << endl;
}
getchar();
}
在定义multiset时候不太懂。为什么要用函数初始化q
[此贴子已经被作者于2017-2-22 15:32编辑过]