Loading...


bookmark - Sorting A String Vector

Sorting A String Vector

 
 Discussion by 7Priest7 with 0 Replies.
 Last Update: May 24, 2007, 9:24 am
 
bookmark - Sorting A String Vector  
Quickly Post to Sorting A String Vector  w/o signup Share Info about Sorting A String Vector  using Facebook, Twitter etc. email your friend about Sorting A String Vector Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

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. B)

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.swap(Names[min]);
}
count=0;
cout << "\nAfter\n\n";
while(count<=2)
{
cout<<Names[count]<<'\n';
count++;
}
return 0;
}

   Thu May 24, 2007    Reply         

Quickly Post to Sorting A String Vector  w/o signup Share Info about Sorting A String Vector  using Facebook, Twitter etc. email your friend about Sorting A String Vector Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

10 Step Tutorial To Create Shiny Ba...

A week back or so, I happened to stumble across Inkscape (http://inkscape.org) and I was hooked. In a few days, I was able to create some things that were recognizable, and I created two clip arts at my blog as give aways: [url="http://www.wisetome.com/splat/2006/12/09/free-clipart-chr ...more

   13-Dec-2006    Reply         

Php String To Int Typecasting

I've been working on writing this program that needs strings to be converted to integers. Sometimes PHP works by doing the converting for me, but sometimes it just breaks down and quits working. I've got no idea why. $sub1 = 0+substr($text, 0, 3); $sub2 = 0 ...more

   25-Mar-2007    Reply         

City By Night Vector Tutorial

City at Night Tutorial This tutorial is based on the wallpaper I design, you will need the following brushes to accomplish this tutorial or other designs like it. As note that a lot of layers will be moved around during the course of this tutorial and I will let you know ...more

   23-Jun-2007    Reply         

Did I Install A C Or A C++ Compiler ? A simple way to see the difference   Did I Install A C Or A C++ Compiler ? A simple way to see the difference (6) (1) Learning C++   Learning  C++