From 2318c9e395241f1a55c68a428170931f5b9f1cd2 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:19:14 +0100 Subject: [PATCH] Commit 25 code --- src/main/c/sudoku.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 705e694..51551e1 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -468,7 +468,24 @@ void inputFunction(int grid[SIZE][SIZE]) { switch (action) { case 1: - printf("Case 1 \n"); + printf("Enter the coordinates (row and column) separated by space:\n"); + int row_e, col_e, num; + + + while (true){ + char rowe_str[10]; + char cole_str[10]; + scanf("%s %s", rowe_str, cole_str); + + row_e = rowe_str[0] - '0'; // Convert the first character to an integer + col_e = cole_str[0] - '0'; // Convert the first character to an integer + + if (((row_e >= 1 && row_e <= 9) && rowe_str[1] == '\0') && ((col_e >= 1 && col_e <= 9) && cole_str[1] == '\0')) { + break; + } else { + printf("Invalid input. Please enter a number between 1 and 9.\n"); + } + } break; case 2: