
27/08/2012, 18:49
|
 | | | Fecha de Ingreso: mayo-2012 Ubicación: Programing Cloud
Mensajes: 282
Antigüedad: 12 años, 9 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");
} |