Browse Source

Commit 26 code

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

19
src/main/c/sudoku.c

@ -485,6 +485,25 @@ void inputFunction(int grid[SIZE][SIZE]) {
} else { } else {
printf("Invalid input. Please enter a number between 1 and 9.\n"); printf("Invalid input. Please enter a number between 1 and 9.\n");
} }
}
printf("Enter the value to insert (1-9):\n");
while (true){
char nume_str[10];
scanf("%s", nume_str);
num = nume_str[0] - '0'; // Convert the first character to an integer
if ((num >= 1 && num <= 9) && nume_str[1] == '\0') {
grid[row_e - 1][col_e - 1] = num;
printf("Value inserted successfully.\n");
break;
} else {
printf("Invalid input. Please enter a number between 1 and 9.\n");
}
} }
break; break;

Loading…
Cancel
Save