Code:
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
#define SIZE 6
#define MAX 53
void printArray(int N[], int T);
void fillArray(int N[], int T);
int main()
{
srand(time(NULL));
int PICKED[] = {0,0,0,0,0,0};
fillArray(PICKED, SIZE);
printArray(PICKED, SIZE);
return 0;
}
void fillArray(int N[], int T)
{
for(int P=0; P<T; P++)
{
N[P] = (int) (rand()% 52+1);
for(int y=0; y<P; y++)
{
if(N[y] == N[P])
{
N[P] = (int) (rand()%52 +1);
P=-1;
}
}
}
}
/* This isn't bubble sort, but it's in the same class as bubble sort */
void printArray(int N[], int T) //T is assigned a value in your sorting loop, so bringing it in as a parameter, makes no sense.
{
int j, P;
for(P=0; P<SIZE-1; P++)
{
//you need an inner for loop, like:
for(j = P + 1; j < SIZE; j++)
{
if(N[P]>N[j])
{
T = N[j];
N[P] = N[j];
N[P] = T;
}
}
}
printf("\nLOTTO PICKS\n");
for(int P=0; P<SIZE; P++)
printf("%d ", N[P]);
printf("\n");
} // ==> }}}} this is a crappy style for code. Each brace should be directly
//beneath the first word of the block of code that it's associated with.