XD, es cierto, mira que lo he dicho, pero se me ha olvidado quitar el =. Hay sueño...
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
#define PATH = "/home/daniel/.drawsom/wordlist"
#define PATH = "/home/daniel/.drawsom/wordlist"
ejecutar_accion(accion, escenario, prota, objeto1, objeto2, lista_objetos)
{
if(accion == UNA_ACCION)
{
if(objeto1 == UN_OBJETO)
{
if(objeto2 == OTRO_OBJETO)
{
una_accion(escenario, prota, objeto1, objeto2, lista_objetos);
}
else if(objeto2 == MAS_OBJETOS)
{
...
}
...
}
}
}
una_accion(escenario, prota, objeto1, objeto2, lista_objetos)
{
Lo mismo de arriba, con if elses compruebo con que par de objetos estoy tratando y actuo en consecuencia.
}
ID1 ID2 ... IDN
ID1 R11 R12 ... R1N
ID2 R21 R22 ... R2N
. . . . .
. . . . .
. . . . .
IDN RN1 RN2 ... RNN
#include <stdlib.h>
#include <time.h>
#define LONGITUD_INTERVALO_FUENTE 20
#define MIN_FUENTE 1
#define NUMERO_VALORES 15
int main(int argc, char *argv[])
{
int vector_fuente[LONGITUD_INTERVALO_FUENTE];
int v1[NUMERO_VALORES] , v2[NUMERO_VALORES] , i , indice , aux;
srand(time(NULL));
/* inicializamos la fuente de los datos */
for(i = 0 ; i < LONGITUD_INTERVALO_FUENTE ; i++)
vector_fuente[i] = MIN_FUENTE + i;
/* Reordenamos los valores*/
for(i = 0 ; i < NUMERO_VALORES ; i++)
{
aux = vector_fuente[i];
vector_fuente[i] = vector_fuente[indice = rand() % LONGITUD_INTERVALO_FUENTE];
vector_fuente[indice] = aux;
}
/* copiamos los valores en el primer vector */
for(i = 0 ; i < NUMERO_VALORES ; i++)
v1[i] = vector_fuente[i];
/* reordenar de nuevo y asignar al segundo vector */
}
10 valores entre 1 y 16. Media 86.00 iteraciones
Vector resultante:
11 9 6 14 10 7 15 1 3 4
15 valores entre 1 y 16. Media 358.11 iteraciones
Vector resultante:
13 15 14 2 5 9 3 10 11 4 1 6 8 12 7
25 valores entre 1 y 51. Media 432.91 iteraciones
Vector resultante:
46 20 28 40 43 17 22 42 36 7 16 10 47 6 34 18 49 30 33 8
26 13 27 25 38
50 valores entre 1 y 51. Media 5217.88 iteraciones
Vector resultante:
39 42 36 25 7 19 23 22 50 41 44 26 2 45 29 18 8 31 28 33
14 4 20 46 30 48 27 10 47 15 40 6 32 16 24 3 21 43 38 49
12 9 13 17 11 1 5 35 37 34
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define RANGO_1 15
#define RANGO_2 50
#define MINIMO 1
#define NUMERO_VALORES_1 10
#define NUMERO_VALORES_2 15
#define NUMERO_VALORES_3 25
#define NUMERO_VALORES_4 50
#define REPETICIONES 2000
int main(int argc, char *argv[])
{
int numero_valores[] = {NUMERO_VALORES_1,NUMERO_VALORES_2,NUMERO_VALORES_3,NUMERO_VALORES_4};
int rangos[] = {RANGO_1,RANGO_2};
int v[NUMERO_VALORES_4];
int total_iteraciones, n_iteraciones , i,j,k, valores_introducidos,valor;
srand(time(NULL));
for(i = 0 ; i < 4 ; i++)
{
total_iteraciones = 0;
for(j = 0 ; j < REPETICIONES ; j++)
{
n_iteraciones = 0;
valores_introducidos = 0;
while(valores_introducidos != numero_valores[i])
{
if(valores_introducidos == 0)
v[0] = rand() % rangos[i / 2] + MINIMO;
else
{
do{
valor = rand() % rangos[i / 2] + MINIMO;
for(k = 0 ; k < valores_introducidos && v[k] != valor ; k++)
n_iteraciones++;
n_iteraciones++;
}while(k < valores_introducidos);
v[valores_introducidos] = valor;
}
valores_introducidos++;
n_iteraciones++;
}
total_iteraciones += n_iteraciones;
}
printf("%d valores entre %d y %d. Media %.2f iteraciones\n\n",
numero_valores[i], MINIMO , MINIMO + rangos[i / 2], ((float) total_iteraciones) / REPETICIONES);
printf("Vector resultante:\n");
for(k = 0 ; k < numero_valores[i] ; k++)
printf("%3d ",v[k]);
printf("\n\n");
}
return 0;
}
scanf ("%s", &ptr_clientes->ciudad);
ptr_clientes++;
}
ptr_clientes++;
int tabla[5][5] =
{{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}};