file://localhost/Users/Admin/Pictures/iPhoto%20Library/Previews/2011/06/04/20110604-135908/DOHOTfA0TE6GwmiVzOOzjQ/P1020321.jpg
(Mac Fag spotted)
-Bien, no me negaréis ahora que este hombre es el más feliz de todos, ya que
desprecia todo cuanto posee.
Martín contestó:
-¿No os dais cuenta de que está hastiado de lo mucho que posee? Ya lo dijo Platón
hace muchos años, que los mejores estómagos son los que no hacen ascos a los
alimentos.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <dos.h>
struct uno{
int num[2];
}*tabla1;
void main (void){
int a=0,b=0,c,cantidad,auxrand,auxnum,choose;
printf("introduce cantidad numeros: ");
scanf("%i",&cantidad);
fflush(stdin);
tabla1=(struct uno )malloc(sizeof(struct uno)cantidad);
randomize();
while (a<cantidad){
tabla1[a].num[0]=rand()%99;
tabla1[a].num[1]=a;
a++;
}
while (a<999){
a=0;
b=0;
c=cantidad;
while (a<c){
while (b<c){
if (tabla1.num[0]>tabla1[b+1].num[0]){
auxrand=tabla1.num[0];
auxnum=tabla1.num[1];
tabla1.num[0]=tabla1[b+1].num[0];
tabla1.num[1]=tabla1[b+1].num[1];
tabla1[b+1].num[0]=auxrand;
tabla1[b+1].num[1]=auxnum;
}
b++;
}
c=c-1;
b=0;
a++;
}
a=0;
while (a<cantidad){
printf("numero: %i orden: %i\n",tabla1[a].num[0],tabla1[a].num[1]);
a++;
}
printf("desea introducer un numero mas\n");
printf("1- SI\n");
printf("2- NO\n");
scanf("%i",&choose);
fflush(stdin);
if (choose==1){
cantidad=cantidad+1;
printf("que numero desea introducir: ");
scanf("%i",&auxrand);
fflush(stdin);
tabla1[cantidad-1].num[0]=auxrand;
tabla1[cantidad-1].num[1]=cantidad-1;
}else{
if (choose==0){
a=999;
}else{
printf("seleccion no valida");
}
}
}
getchar();
}