I did this code for a reason...
It was a school project...

I could not find this info anywhere...
Maybe it will be use to some1 else. smile.gif

CODE
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
int count=0;
vector<string> Names(2);
Names[0]="Alexa";
Names[1]="Alexc";
Names[2]="Alexb";

cout << "Before\n\n";
while(count<=2)
{
cout<<Names[count]<<'\n';
count++;
}
int i,j;
int min;

for(i=0;i< 3 - 1;i++)
{
min = i;

for (j = i + 1; j<3;j++)
{
if (Names[j] < Names[min]){min=j;}}
Names[i].swap(Names[min]);
}
count=0;
cout << "\nAfter\n\n";
while(count<=2)
{
cout<<Names[count]<<'\n';
count++;
}
return 0;
}

 

 

 


Reply