Browse Source

Commit 5 code

remotes/origin/Lucas
Lucas Heil 11 months ago
parent
commit
7dc3d6e0f9
  1. 19
      src/main/c/sudoku.c

19
src/main/c/sudoku.c

@ -1,6 +1,3 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
@ -59,7 +56,21 @@ void availableLevelsFunction(int difficulty) {
void selectLevel(int grid[SIZE][SIZE]) {
int level = 0;
printf("\nSelect a level:\n");
while (true){
char level_select[10];
scanf("%s", level_select);
level = level_select[0] - '0'; // Convert the first character to an integer
if ((level >= 1 && level <= 3) && level_select[1] == '\0') {
printf("Input is correct");
break;
} else {
printf("Invalid input. Please enter a number between 1 and 3.\n");
}
}
}

Loading…
Cancel
Save