Browse Source

Commit 2 code

main^2
Lucas Heil 11 months ago
committed by Peter Wiebe
parent
commit
c4026961b4
  1. 14
      src/main/c/sudoku.c

14
src/main/c/sudoku.c

@ -1,3 +1,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
@ -13,6 +18,8 @@ int selected_level;
void startSudoku(); //is instead of main void startSudoku(); //is instead of main
void availableLevelsFunction(int difficulty);
void startSudoku() { void startSudoku() {
int grid[SIZE][SIZE]; int grid[SIZE][SIZE];
@ -33,7 +40,7 @@ void startSudoku() {
difficulty = input[0] - '0'; // Convert the first character to an integer difficulty = input[0] - '0'; // Convert the first character to an integer
if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') { if ((difficulty >= 1 && difficulty <= 3) && input[1] == '\0') {
printf("Input is correct");
availableLevelsFunction(difficulty);
} else { } else {
printf("Invalid input. Please enter a number between 1 and 3.\n"); printf("Invalid input. Please enter a number between 1 and 3.\n");
} }
@ -41,6 +48,11 @@ void startSudoku() {
} }
} }
void availableLevelsFunction(int difficulty) {
printf("\nAvailable Levels for Difficulty %d:\n", difficulty);
}
int main(){ int main(){
startSudoku(); startSudoku();
return 0; return 0;
Loading…
Cancel
Save