Here's a basic bubble sort of the sLeaderTypes you wanted, I added a few more to make sure my sort was working correctly. Which it seems to be....
Code:
#include <string>
#include <iostream>
using namespace std;
#define SIZE 100
void bubbleSort(string array[8]);
void swap(string *, string *);
int main()
{
int i=0, count=9;
string sLeaderTypes[] = {"Emperor","King","Tyrant","President","Warlord","Prince","Baron","Queen","Dictator"};
cout << endl << "Data items in original order" << endl;
for (i = 0; i < count; i++)
cout <<sLeaderTypes[i] << endl;
bubbleSort(sLeaderTypes); // sort the array
cout <<"Sorted list:";
for (i = 0; i < count; i++)
cout <<endl << sLeaderTypes[i];
return 0;
}
void bubbleSort(string array[8])
{
int pass, size = 9;
for (pass = 1; pass <= size - 1; pass++)
for (int j = 0; j <= size - 2; j++)
if ((array[j].compare(array[j + 1]) > 0))
swap(array[j], array[j + 1]);
}
void swap(string *element1Ptr, string *element2Ptr)
{
string temp;
temp = *element1Ptr;
*element1Ptr = *element2Ptr;
*element2Ptr = temp;
}