you mean so that the result looks like this?
0000000000
1654
Contact
Example
Laptop
Phone
a
l.jl
m
sip:contact@minisip.org
Press any key to continue . . .
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>
using namespace std;
std::string strings[] = {
"<phonebook>",
"<name>",
"Example",
"</name>",
"<contact>",
"<name>",
"Contact",
"</name>",
"<pop>",
"<desc>",
"Phone",
"</desc>",
"<uri>",
"0000000000",
"</uri>",
"</pop>",
"<pop>",
"<desc>",
"Laptop",
"</desc>",
"<uri>",
"sip:contact@minisip.org",
"</uri>",
"</pop>",
"<pop>",
"<desc>",
"a",
"</desc>",
"<uri>",
"1654",
"</uri>",
"</pop>",
"<pop>",
"<desc>",
"m",
"</desc>",
"<uri>",
"l.jl",
"</uri>",
"</pop>",
"</contact>",
"</phonebook>",
};
const int sz = sizeof(strings) / sizeof(strings[0]);
int main()
{
vector<string> theList;
for(int i = 0; i < sz; i++)
theList.push_back(strings[i]);
std::sort(theList.begin(), theList.end());
for(int i = 0; i < sz; i++)
cout << theList[i] << "\n";
} Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343