
Enviado em 29/05/2018 - 01:26h
"Boa meia noite"! Estou estudando por conta própria algoritmos de ordenação de vetores e eu estava olhando mais sobre
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
int main(void){
int vet[SIZE]={45, 20, 89, 60, 35, 78, 13, 25, 97, 61};
printf("\n\nDesordenado: ");
for(unsigned int i=0; i<SIZE; i++){
printf("[%d] ", vet[i]);
}
printf("\n\n");
int swap;
for(unsigned int x=0; x<SIZE; x++){
for(unsigned int y=0; y<SIZE; y++){
if(vet[x]<vet[y]){
swap=vet[x];
vet[x]=vet[y];
vet[y]=swap;
}
}
}
printf("\n\nOrdenado: ");
for(unsigned int i=0; i<SIZE; i++){
printf("[%d] ", vet[i]);
}
printf("\n\n");
system("pause"); //troll detected...
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
int main(void){
int vet[SIZE]={45, 20, 89, 60, 35, 78, 13, 25, 97, 61};
printf("\n\nDesordenado: ");
for(unsigned int i=0; i<SIZE; i++){
printf("[%d] ", vet[i]);
}
printf("\n\n\n\tOrdenando: \n\n\n");
int swap;
for(unsigned int x=0; x<SIZE; x++){
for(unsigned int y=0; y<SIZE; y++){
printf("[%d]=%d eh menor que [%d]=%d??? ", x, vet[x], y, vet[y]);
if(vet[x]<vet[y]){
printf("Yes!\n\n");
swap=vet[x];
vet[x]=vet[y];
vet[y]=swap;
for(unsigned int i=0; i<SIZE; i++){
printf("[%d] ", vet[i]);
}
printf("\n\n");
}else{
printf("No!\n");
}
}
}
printf("\n\nOrdenado: ");
for(unsigned int i=0; i<SIZE; i++){
printf("[%d] ", vet[i]);
}
printf("\n\n");
return 0;
}
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Instalando COSMIC no Linux Mint
Turbinando o Linux Mint: o poder das Nemo Actions
Inteligência Artificial no desenvolvimento de software: quando começar a usar?
O widget do Plasma 6 Área de Notificação
[Resolvido] Algo deu errado ao abrir seu perfil
Quando vocês pararam de testar distros? (14)
Problema com som no laptop (3)
Não estou conseguindo fazer funcionar meu Postfix na versão 2.4 no Deb... (2)









