Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/08/2012, 18:49
Avatar de cronopiomx
cronopiomx
 
Fecha de Ingreso: mayo-2012
Ubicación: Programing Cloud
Mensajes: 282
Antigüedad: 11 años, 11 meses
Puntos: 28
Respuesta: Ordenar alfabeticamente

tambien te puede servir esto usando Buble Sort y string, para comparar con arrays de char tienes que hacer con la funcion strcmp(... , ...),

s2
cronos

#include <iostream>
#include <string.h>
using namespace std;

int main ()
{
string a[] = {"aa", "bb"};
string temp = "";

for (int i =0; i < 2; i++)
for (int j = i+1; j < 2; j++)
if (a[i]>a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}


for (int i =0; i < 2; i++)
cout<<a[i]<<endl;



system("pause");
}