Browse Source

Commit 28 - func level_plus einbauen

main^2
Peter Wiebe 11 months ago
committed by Peter Wiebe
parent
commit
ab24d1d021
  1. 28
      src/main/c/hangman.c

28
src/main/c/hangman.c

@ -20,6 +20,7 @@ void lade_secret_word(char* secret_word, int level, char* path);
void show_letters(char secret_word[100], char guessed_letters[100]);
int letter_in_secret_word(char guessed_letter, char secret_word[100]);
int has_won(char secret_word[100], char guessed_letters[100]);
void level_plus();
void protokoll(){
clear_screen();
@ -342,3 +343,30 @@ int has_won(char secret_word[100], char guessed_letters[100]){
}
return 1;
}
void level_plus(){
char KonfDatei[100];
char levelstr[3];
int i = 0;
FILE *fp = NULL;
fp = fopen("hangman.txt", "r+");
fscanf(fp, "%s", KonfDatei);
while(KonfDatei[i] != 0){
i++;
}
levelstr[0] = KonfDatei[i-2];
levelstr[1] = KonfDatei[i-1];
levelstr[2] = '\0';
if (levelstr[1] == '9'){
KonfDatei[i-2]++;
KonfDatei[i-1] = '0';
} else {
KonfDatei[i-1]++;
}
fclose(fp);
fp = fopen("hangman.txt", "w");
fprintf(fp, "%s", KonfDatei);
fclose(fp);
}
Loading…
Cancel
Save