arrays - Sudoku Checker in C Issues -


i have sudoku checker assignment class , task able create code ask how many puzzles user solve they'll input of numbers themselves. after input numbers, output either "yes" or "no" in response if puzzle(s) correct. far i've been able manipulate code let user input of numbers i'm stuck on how able check if each number in same row, column, , 3x3 square not repeated. tips on how me started on checking grateful because i'm stumped on part.

heres code far

#include <stdio.h> #define col 9  int main (void)  { int n, i, j,array[100][col]; int check=0;  scanf("%d", &n); //enter how many puzzles want solve  //for loop goes through every position in puzzle(s) for(i=0;i<n*9;i++) {   for(j=0;j<col;j++)     {         //array[i][j]=0;         //printf("array[%d][%d]=%d\n", i,j,array[i][j]);     scanf("%d", &array[i][j]); //user entry puzzle(s)     } } return 0; } 

first, don't need array of size 100.

then, what's problem? first things first, have read input user, doing.

afterward, have perform 3 checks:

  • for each line / column:
    • each item in given line has uniq
    • each item in given column has uniq
  • for each "sub array" (which know statically, don't try fancy here), must apply same rule.

if show code, we'll trying figure out what's wrong. otherwize, go , done.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -