Browse Source

Commit 1 code

remotes/origin/Lucas
Lucas Heil 11 months ago
parent
commit
98f46f8da8
  1. 47
      src/main/c/sudoku.c

47
src/main/c/sudoku.c

@ -0,0 +1,47 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#define SIZE 9
#define EMPTY 0
#define LEVEL_NUMBER 3
int difficulty;
int selected_level;
void startSudoku(); //is instead of main
void startSudoku() {
int grid[SIZE][SIZE];
selected_level = 0;
while (1) {
printf("\nDifficulty Function - Choose difficulty:\n");
printf("1. Easy\n2. Medium\n3. Hard\n");
printf("Enter the corresponding number or type 'quit' to exit: ");
char input[10];
scanf("%s", input);
if (strcmp(input, "quit") == 0) {
break;
}
difficulty = input[0] - '0'; // Convert the first character to an integer
if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') {
printf("Input is correct");
} else {
printf("Invalid input. Please enter a number between 1 and 3.\n");
}
}
}
int main(){
startSudoku();
return 0;
}
Loading…
Cancel
Save