From 2cf8b6b149ca0cd2c43f2b8afc68f79d00c0eda0 Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 15 Dec 2025 15:44:29 +0100 Subject: [PATCH] =?UTF-8?q?=C3=84nderung=20highscores.txt=20automatisch=20?= =?UTF-8?q?l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bintree.c | 3 ++- highscores.txt | 10 ---------- main.c | 4 ++-- makefile | 3 ++- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/bintree.c b/bintree.c index 90e963f..4505691 100644 --- a/bintree.c +++ b/bintree.c @@ -69,7 +69,8 @@ TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, // direction. Use your implementation of a stack to organize the iterator. Push // the root node and all left nodes first. On returning the next element, push // the top node and push all its left nodes. -void *nextTreeData(TreeNode *root) { +void *nextTreeData( + TreeNode *root) { // highscore nutzt Funktion für die Ausgabe der Punktzahl static StackNode *stack = NULL; // static -> behält Wert bei mehreren Aufrufen // Neue Iteration starten diff --git a/highscores.txt b/highscores.txt index a4f4431..e69de29 100644 --- a/highscores.txt +++ b/highscores.txt @@ -1,10 +0,0 @@ -Kristin;49209 -krisp;29797 -krisp;29792 -Kristin;29782 -Kristin;19943 -krisp;19934 -krisp;19916 -kristin;19861 -Kristin;19858 -p;19729 diff --git a/main.c b/main.c index 1dd21cf..21114f8 100644 --- a/main.c +++ b/main.c @@ -3,7 +3,7 @@ #include "timer.h" #include #include -#include +#include // für Zufallszahlen hinzugefügt // Read an unsigned integer from stdin with prompt (retries until valid). int inputNumber(const char *promptText) { @@ -35,7 +35,7 @@ void showNumbers(const unsigned int *numbers, unsigned int len) { // Main game loop: generate numbers, ask user for duplicate, measure time, // update highscores. int main(int argc, char *argv[]) { - srand(time(NULL)); // seed für srand + srand(time(NULL)); // seed für srand nachträglich eingefügt int exitCode = EXIT_FAILURE; if (argc != 2) { diff --git a/makefile b/makefile index 805ac68..aa186de 100644 --- a/makefile +++ b/makefile @@ -69,4 +69,5 @@ test_binary.o: test_binary.c # Clean # -------------------------- clean: - rm -f *.o doble $(STACK_TEST_BIN) $(NUMBERS_TEST_BIN) $(BINARY_TEST_BIN) \ No newline at end of file + rm -f *.o doble $(STACK_TEST_BIN) $(NUMBERS_TEST_BIN) $(BINARY_TEST_BIN) + > highscores.txt \ No newline at end of file