Compare commits
No commits in common. "0b7c3ba42d7e7e902e4cc8cc4440555cce6269dd" and "694f8ce9f49c4bad091bb473d78425460d5f8feb" have entirely different histories.
0b7c3ba42d
...
694f8ce9f4
2
hallo.c
2
hallo.c
@ -3,7 +3,7 @@
|
||||
int main() {
|
||||
int max_zahlen, i, eingabe;
|
||||
|
||||
printf("Gib ein wie viele Zahlen verglichen werden sollen: \n ");
|
||||
printf("Gib ein wie viele Zahlen verglichen werden sollen: ");
|
||||
if (scanf("%d", &max_zahlen) != 1) {
|
||||
printf("Ungueltige Eingabe, bitte eine ganze Zahl eingeben.\n");
|
||||
while (getchar() != '\n');
|
||||
|
40
modus.c
40
modus.c
@ -1,40 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
int randnumber() {
|
||||
return rand() % 99;
|
||||
}
|
||||
|
||||
int maximumnumb() {
|
||||
int maxnumber;
|
||||
printf("Wie viele Zufallswerte (1..1000): ");
|
||||
scanf("%d", &maxnumber);
|
||||
return maxnumber;
|
||||
}
|
||||
|
||||
void numberinarry(int *array, int size) {
|
||||
int j;
|
||||
for (j = 0; j < size; j++) {
|
||||
array[j] = randnumber();
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
srand(time(NULL)); // Initialisiere den Zufallszahlengenerator nur einmal
|
||||
|
||||
int maxnumber = maximumnumb();
|
||||
int numbers[maxnumber];
|
||||
|
||||
numberinarry(numbers, maxnumber);
|
||||
|
||||
printf("Die Zufallszahlen sind: ");
|
||||
int i;
|
||||
for (i = 0; i < maxnumber; i++) {
|
||||
printf("%d ", numbers[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user