class test{
int position, value;
public:
test (int a, int b){ position = a; value = b;
}
//...
vector <test> o;
//read some values
//sort the class by value
Take a look at http://www.cplusplus.com/reference/algorithm/sort/
If I understand you corectly, you may want to write a comparision function.
something like bool cmp(test a, test b){ return a.value < b.value; }
Hope this helps