Browse Source

Commit 18 code

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

19
src/main/c/sudoku.c

@ -381,7 +381,24 @@ void tipFunction(int grid[SIZE][SIZE]) {
switch (option) { switch (option) {
case 1: case 1:
printf("Case 1\n");
printf("Enter the coordinates (row and column) separated by space:\n");
int row, col;
while (true){
char row_str[10];
char col_str[10];
scanf("%s %s", row_str, col_str);
row = row_str[0] - '0'; // Convert the first character to an integer
col = col_str[0] - '0'; // Convert the first character to an integer
if (((row >= 1 && row <= 9) && row_str[1] == '\0') && ((col >= 1 && col <= 9) && col_str[1] == '\0')) {
break;
} else {
printf("Invalid input. Please enter a number between 1 and 9.\n");
}
}
break; break;
case 2: case 2:

Loading…
Cancel
Save