|
@ -2,9 +2,12 @@ |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include <time.h> |
|
|
#include <time.h> |
|
|
|
|
|
|
|
|
int run_magiceightball() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int gib_zufallszahl_aus_16() { |
|
|
srand(time(NULL)); |
|
|
srand(time(NULL)); |
|
|
|
|
|
return rand() % 16; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int run_magiceightball() { |
|
|
|
|
|
|
|
|
char antwort[16][100] = { |
|
|
char antwort[16][100] = { |
|
|
"Ja", |
|
|
"Ja", |
|
@ -30,7 +33,7 @@ int run_magiceightball() { |
|
|
char fragesatz[100]; |
|
|
char fragesatz[100]; |
|
|
fgets(fragesatz, sizeof(fragesatz), stdin); |
|
|
fgets(fragesatz, sizeof(fragesatz), stdin); |
|
|
|
|
|
|
|
|
int randomIndex = rand() % 16; |
|
|
|
|
|
|
|
|
int randomIndex = gib_zufallszahl_aus_16(); |
|
|
printf("%s\n", antwort[randomIndex]); |
|
|
printf("%s\n", antwort[randomIndex]); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |