Skip to content

Commit

Permalink
55.- C++ desde cero 2019🦸‍♂️ [Ordenamiento por selección]
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed Apr 6, 2020
1 parent 7487c55 commit 1414384
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Binary file added ejercicios/Selection-Sort-Animation.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions ejercicios/eje38OrdenaientoSeleccion.cpp
@@ -0,0 +1,40 @@
#include <iostream>

int main(){
int numeros[5],min,aux;
std::cout<<"Humano ingresa 5 numeros enteros:\n";
for (int i = 0; i < 5; i++)
{
std::cout<<i+1<<" ";
std::cin>>numeros[i];
}
for (int i = 0; i < 5; i++)
{
min=i;
for (int j = i+1; j < 5; j++)
{
if(numeros[min]>numeros[j]){
min=j;
}
}
aux=numeros[i];
numeros[i]=numeros[min];
numeros[min]=aux;
}
std::cout<<"Humano aqui esta tu pinches numero ordenados de forma acendente:\n";
for (int i = 0; i < 5; i++)
{
std::cout<<numeros[i]<<"\n";
}
std::cout<<"Humano aqui esta tu pinches numero ordenados de forma decendente:\n";
for (int i = 4; i >= 0; i--)
{
std::cout<<numeros[i]<<"\n";
}




system("pause");
return 0;
}
Binary file added ejercicios/eje38OrdenaientoSeleccion.exe
Binary file not shown.

0 comments on commit 1414384

Please sign in to comment.