Este es mi código:
Código
#include <iostream> using namespace std; int main() { setlocale(LC_CTYPE, "Spanish"); int numeros[10], aux; cout << ">> Ingrese la cantidad de numeros que desee" << endl; cout << ">> Ingrese 0 para terminar" << endl <<endl; for (int i = 0; i<10; i++) { cout << "- "; cin >> numeros[i]; if (numeros[i] !=0) { cout << "- "; cin >> numeros[i]; } else { break; } } cout << "" << endl; cout << "Los numeros ingresados fueron: "; for (int i = 0; i<10; i++) { cout << numeros[i]; if(i !=9) { cout << ", "; } } for (int i = 0; i<9; i++) { for (int j=0; j<9; j++) { if (numeros[j] > numeros[j+1]) { aux = numeros[j]; numeros[j] = numeros[j+1]; numeros[j+1] = aux; } } } cout << "" << endl << endl; cout << "Los numeros ingresados ordenados de menor a mayor: "; for (int i = 0; i<10; i++) { cout << numeros[i]; if(i !=9) { cout << ", "; } } return 0; }
MOD: Etiqueta GeSHi agregada.