7Priest7 0 Report post Posted May 24, 2007 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. 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.swap(Names[min]); } count=0; cout << "\nAfter\n\n"; while(count<=2) { cout<<Names[count]<<'\n'; count++; } return 0;} linenums:0'>#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.swap(Names[min]); } count=0; cout << "\nAfter\n\n"; while(count<=2) { cout<<Names[count]<<'\n'; count++; } return 0;} Share this post Link to post Share on other sites