is this a good program?
i just wrote it for the super lottos plus
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 <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int y[6], t;
srand((unsigned) time(NULL));
for (t = 0; t < 5; t++)
{
y[t] = rand() % 47 + 1;
}
y[5] = rand() % 27 + 1;
printf("5 + mega\n");
for (t = 0; t < 6; t++)
{
printf("%d ", y[t]);
}
return 0;
}
|
Last edited on
Can the same number be picked twice in the first five? Should it be possible?
yea
i need a nifty c program to do sorting
something better than simple bubble sort
one that checks each one and makes sure a new number
is picked and doesn't have any repeats for first 5 numbers
Last edited on
got any ideas how to check and guarantee non repeat of number?
could check 0 array element to 1 array element
0 proably need to check 2+ also
and if 1 check 2 array element
2 need to check 0 array element and so on