amigos necesito ayuda para modificar este codigo
Publicado por Mario Alberto (19 intervenciones) el 14/02/2020 16:20:46
hola amigos necesito modificar este codigo y cambiarle el clclo de for a while
es en c++ me podrian ayudar
es en c++ me podrian ayudar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdlib.h>
#include <time.h>
#include<iostream>
using namespace std;
int main()
{
int ordenado = 1, numero, indice;
int arreglo[20];
srand(time(NULL));
for (int valor = 0;valor <= 19;valor++) {
indice = valor;
numero = 1 + rand() % 20;
for (int inicio = 0; inicio <= indice; inicio++) {
if (numero == arreglo[inicio]) {
indice = indice - indice;
valor = valor - 1;
}
while ((indice == valor) && (numero != arreglo[inicio]) && (inicio == valor)) {
arreglo[valor] = numero;
cout << "," << arreglo[valor];
}
}
}
return 0;
}
Valora esta pregunta


0