You will need to create a simple struct,containing hi-score,name,and date(and other information you desire).After that you would create a vector of this structs and sort them by hi-score member.Offcourse you would need to write your own compare function and pass it as the third argument.
Hi, i think i tried to do what you mentioned but i am getting errors:
// sort algorithm example
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int i,int j) { return (i<j); }
class tryClass
{
public:
int a, b;
};
int main ()
{
tryClass *temp_Obj;
vector<tryClass> myvector;
vector<tryClass>::iterator it;
for(int i=1; i<= 8; i++)
{
temp_Obj = new(tryClass);
(*temp_Obj).a = 100 - i;
(*temp_Obj).b = i+10;
myvector.push_back(*temp_Obj);
}
// using function as comp
//sort (myvector.begin(), myvector.end(), myfunction);
// print out content:
cout << "myvector contains:" << endl;
for (it=myvector.begin(); it!=myvector.end(); ++it)
cout << " (" << (*it).a << ", " << (*it).b << ")" << endl;
cout << endl;
return 0;
}
Any suggestions?