Browse Source

Commit 20 code

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

19
src/main/c/sudoku.c

@ -404,7 +404,24 @@ void tipFunction(int grid[SIZE][SIZE]) {
break; break;
case 2: case 2:
printf("Case 2\n");
printf("Enter the coordinates (top-left cell of the 3x3 field) separated by space:\n");
int startRow, startCol;
while (true){
char row_squ[10];
char col_squ[10];
scanf("%s %s", row_squ, col_squ);
startRow = row_squ[0] - '0'; // Convert the first character to an integer
startCol = col_squ[0] - '0'; // Convert the first character to an integer
if (((startRow >= 1 && startRow <= 9) && row_squ[1] == '\0') && ((startCol >= 1 && startCol <= 9) && col_squ[1] == '\0')) {
break;
} else {
printf("Invalid input. Please enter a number between 1 and 9.\n");
}
}
break; break;
case 3: case 3:

Loading…
Cancel
Save