Browse Source

Funktion für zufällige Frage

remotes/origin/Pascal
Pascal Schneider 11 months ago
parent
commit
6a8e240d25
  1. 7
      src/timequiz.c

7
src/timequiz.c

@ -54,8 +54,13 @@ void timequiz() {
memset(askedQuestions, 0, sizeof(askedQuestions)); memset(askedQuestions, 0, sizeof(askedQuestions));
srand((unsigned int)time(NULL)); srand((unsigned int)time(NULL));
}
int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) { int getRandomQuestionIndex(int askedQuestions[], int totalQuestions) {
int questionIndex;
do {
questionIndex = rand() % totalQuestions;
} while (askedQuestions[questionIndex] == 1);
return questionIndex;
} }
}
Loading…
Cancel
Save