How to get vector pair in numerical order (lowest # first)

so let say my infile looks like this
3212 rrrr
11 wrwn
233 mtgn
1561 fffse
3166 whbeh

How do I get my output in the order?

#include <iostream>
#include <vector>
#include<fstream>
#include <string>
#include <utility>
#include <sstream>
#include <algorithm>
#include <iterator>
using namespace std;
int main()
{
fstream ifile("hi");
if (!ifile.good())
{
cerr << "Unable to open hi" << endl;
return 255;
}

string header;
getline(ifile, header);
cout << header << endl;

string line;
while (getline(ifile, line))
{

istringstream iss(line);

vector< pair<int,string> > seq ;

int number ;
string text ;

while( iss >> number >>text)
{

seq.push_back( make_pair(number,text) ) ;
}

sort( seq.begin(), seq.end() );

for( size_t i = 0 ; i < seq.size() ; ++i )
cout << seq[i].first << ' ' << seq[i].second << '\n' ;

}
ifile.close();
return 0;
}
You seem to sort already. What is the problem?
i am still not getting the numbers in numberical order so this is what it needs to look like
3437 FRANZ
10447 MOTE
18049 PAULING

but this what it looks like now
3437 FRANZ
18049 PAULING
10447 MOTE
How about code tags and sensible indentation? (It should help seeing the problem.)
could u give me a example on what that look like
Topic archived. No new replies allowed.