#include <iostream>
#include <iomanip>
#include <conio.h>
#include <string.h>
using namespace System;
using namespace std;
char NOMBRES [10][25];
void main ()
{
int r;
cout<<"n cuantas personas desea procesar: ";
cin>>r;
int x;
for (x=0;x<=r-1;x++)
{
cout<<"n digite el nombre de la person numero "<<x+1;
cin. ignore();
cin.getline (NOMBRES [x],25);
}
//ORDENAMIENTO DEL VECTOR TIPO CHAR
char temp[25];
for (int i=0;i<=r-2;i++)
{
for (int j=i+1;j<=r-1;j++)
{
if (strcmp (NOMBRES[i],NOMBRES[j])>0)
{
strcpy(temp,NOMBRES [i]);
strcpy(NOMBRES [i],NOMBRES [j]);
strcpy(NOMBRES [j],temp);
}
}
}
//IMPRESION DEL VECTOR ORDENADO
int u;
for (u=0;u<=r-1;u++)
{
cout<<"n"<<NOMBRES [u];
}
getch ();
}

Feb28

  • 1.
    #include <iostream> #include <iomanip> #include<conio.h> #include <string.h> using namespace System; using namespace std; char NOMBRES [10][25]; void main () { int r; cout<<"n cuantas personas desea procesar: "; cin>>r; int x; for (x=0;x<=r-1;x++) { cout<<"n digite el nombre de la person numero "<<x+1; cin. ignore(); cin.getline (NOMBRES [x],25); } //ORDENAMIENTO DEL VECTOR TIPO CHAR char temp[25]; for (int i=0;i<=r-2;i++) { for (int j=i+1;j<=r-1;j++) { if (strcmp (NOMBRES[i],NOMBRES[j])>0) { strcpy(temp,NOMBRES [i]); strcpy(NOMBRES [i],NOMBRES [j]); strcpy(NOMBRES [j],temp); } } } //IMPRESION DEL VECTOR ORDENADO int u; for (u=0;u<=r-1;u++) { cout<<"n"<<NOMBRES [u]; } getch (); }