included header file, not sure why tho lol

This commit is contained in:
Jannis Heydemann
2026-05-27 13:26:37 +02:00
parent 3682c3f3bb
commit bf2f285b7d
2 changed files with 33 additions and 27 deletions

28
main.c
View File

@@ -1,8 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "main.h"
int getRandomNumber();
int askForRepeat();
int running = 1;
int main()
@@ -39,28 +38,3 @@ int main()
return 0;
}
int getRandomNumber(int limiter)
{
return rand() % limiter;
}
int askForRepeat()
{
char nochmal;
printf("Willst du nochmal spielen?\n");
scanf("%c", &nochmal);
if (nochmal == 'j')
{
return 1;
}
else if (nochmal == 'n')
{
return 0;
}
else
{
printf("Input konnte nicht gelesen werden\n");
return askForRepeat();
}
}

32
main.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef main_h
#define main_h
#include <stdlib.h>
#include <stdio.h>
int getRandomNumber(int limiter)
{
return rand() % limiter;
}
int askForRepeat()
{
char nochmal;
printf("Willst du nochmal spielen?\n");
scanf("%c", &nochmal);
if (nochmal == 'j')
{
return 1;
}
else if (nochmal == 'n')
{
return 0;
}
else
{
printf("Input konnte nicht gelesen werden\n");
return askForRepeat();
}
}
#endif