Änderung highscores.txt automatisch löschen

This commit is contained in:
Kristin 2025-12-15 15:44:29 +01:00
parent 7683a157c9
commit 2cf8b6b149
4 changed files with 6 additions and 14 deletions

View File

@ -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

View File

@ -1,10 +0,0 @@
Kristin;49209
krisp;29797
krisp;29792
Kristin;29782
Kristin;19943
krisp;19934
krisp;19916
kristin;19861
Kristin;19858
p;19729

4
main.c
View File

@ -3,7 +3,7 @@
#include "timer.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <time.h> // 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) {

View File

@ -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)
rm -f *.o doble $(STACK_TEST_BIN) $(NUMBERS_TEST_BIN) $(BINARY_TEST_BIN)
> highscores.txt