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.

55 lines
1.1 KiB

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "raetselronja.h"
  5. #include "userinput.h"
  6. int zahlenraetsel(int input[], int loesung, int n) {
  7. //gegebene zahlen printne und nach ölösungun fragen
  8. int eingabe = 0;
  9. for(int i = 0; i < n; i++){
  10. printf("%d", input[i]);
  11. if (i < n -1){
  12. printf(",");
  13. }
  14. printf(" ");
  15. }
  16. printf("\n");
  17. printf("Bitte geben Sie die Loesung ein.\n");
  18. eingabe = userInput(); //hier stand mal scanf,jetzt kommt das in eine Funktion zum testen
  19. if (eingabe == loesung){
  20. return 1;
  21. printf("Die Antwort ist richtig.\n");
  22. }
  23. else{
  24. return 0;
  25. printf("Die Antwort ist falsch.\n");
  26. }
  27. }
  28. int raetselaufruf(){
  29. int auswahl = 1;
  30. int loesung = 0;
  31. switch (auswahl) {
  32. case 1:
  33. int input[] = {25, 50, 54, 49, 98, 102, 97, 194};
  34. int n = 8;
  35. loesung = 198;
  36. zahlenraetsel(input, loesung, n);
  37. break;
  38. default: return -1;
  39. }
  40. return auswahl;
  41. }
  42. //Zahlenrätsel : 25,50,54,49,98,102,97,194
  43. //256,289,324,361,