You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. #include "quizduell.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6. QuizFrage erstelleFrage(const char* frage, const char* antwortA, const char* antwortB, const char* antwortC, const char* antwortD, char korrekteAntwort) {
  7. QuizFrage neueFrage;
  8. strcpy(neueFrage.frage, frage);
  9. strcpy(neueFrage.antwortA, antwortA);
  10. strcpy(neueFrage.antwortB, antwortB);
  11. strcpy(neueFrage.antwortC, antwortC);
  12. strcpy(neueFrage.antwortD, antwortD);
  13. neueFrage.korrekteAntwort = korrekteAntwort;
  14. return neueFrage;
  15. }
  16. void zeigeVerfuegbareKategorien(Kategorie kategorien[]) {
  17. printf("\nChoose a Category:\n");
  18. if (kategorien[0].fragen != NULL) printf("Mountains\n");
  19. }
  20. void quizduell() {
  21. printf("Welcome to the singleplayer quizduell!\n");
  22. Kategorie kategorien[MAX_CATEGORIES];
  23. kategorien[0].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage));
  24. kategorien[0].fragen[0] = erstelleFrage("Whats the height of the Zugspitze?", "2482 Meter", "2867 Meter", "2962 Meter", "3173 Meter", 'C');
  25. kategorien[0].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY;
  26. kategorien[0].joker = 1;
  27. while (1) {
  28. char auswahl[50];
  29. zeigeVerfuegbareKategorien(kategorien);
  30. return;
  31. }
  32. }