Sort a string array with sort()

Started by aruljothi, Jun 11, 2009, 09:50 PM

Previous topic - Next topic

aruljothi

 
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
   string words[5] = { "ABCD", "BCDEF", "CERF","DERT", "EFRE"};
   string*   where;

   where = find(words, words + 5, "CD");
   
   cout << *++where << endl;               
   
   sort(words, words + 5);
   
   where = find(words, words + 5, "ER");
   cout << *++where << endl;             
}