Questão
ID 2643314Disciplina: Tecnologia da Informação
Assunto: Selection Sort (Selecione)
Ano: 2014 Banca: FUNCAB - Fundação Professor Carlos Augusto Bittencourt Órgão: Empresa de Desenvolvimento Urbano e Rural de Toledo
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
int main () {
char vet1[6] [50], vet2[6] [50];
int i,j,x,y;
i=0;
while (i <=5) {
______gets (vet1[i]);
______i++;}
i=0;
j=1;
for ( x = 0; x < 6; x++ ) {
__for ( y = x + 1; y < 6; y++ ) {
____if ( vet1[x] [j] > vet1[y] [j] ) {
_________strcpy (vet2[i], vet1[x]);
_________strcpy (vet1[x], vet1[y]);
_________strcpy (vet1[y], vet2[i]);}
_______}}
}
O código em C++ acima produz como saída o vetor de string: