From 63f52c7292e4785a2af28e1acecb33add2d9e401 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:20:19 +0100 Subject: [PATCH] Commit 26 code --- src/main/c/sudoku.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/c/sudoku.c b/src/main/c/sudoku.c index 51551e1..74e1c47 100644 --- a/src/main/c/sudoku.c +++ b/src/main/c/sudoku.c @@ -485,6 +485,25 @@ void inputFunction(int grid[SIZE][SIZE]) { } else { 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;