#include #include #include #define ELEMENTE 20 #define RANGE 49 #define BAELLE 6 int rnd(int range); const int SIZE = 6; void seedrnd(void); void sort(int* array, int size); void main() { int nummern[RANGE]; int ausgabe[BAELLE]; int eingabe[BAELLE]; int b; int i=0; int x=0; printf("Lotto Ziehung (6 aus 49) \n\n"); seedrnd(); while ( i < RANGE) { nummern[i]=0 ; i=i+1; } printf("Bitte geben sie ihren Tipp ab:"); while (i < BAELLE) { scanf("%i", &(eingabe[i]) ); i=i+1; } sort(eingabe, BAELLE); for(x=0; x < BAELLE; x++) printf("%i\t " , eingabe[x]); //getchar(); i=0; while (i < BAELLE) { b = rnd(RANGE); while(nummern[b-1]); { nummern[b-1] = 1; ausgabe[i] = b; } i=i+1; } sort(ausgabe, BAELLE); printf("Die heutige Ziehung ergibt: \n"); for(x=0; x < BAELLE; x++) printf("%i\t " , ausgabe[x]); printf(" \n"); vergleichen(eingabe, ausgabe, BAELLE); } int rnd (int range) { int r; r = rand() % (range+1); return r; } void seedrnd(void) { srand((unsigned)time(NULL)); } void vergleichen(int* eingabe, int* ausgabe, int groesse) { int i,j; int treffer=0; for(i=0; i array[j]) { temp = array[j]; array[j] = array[i]; array[i] = temp; } } } }