View Single Post
Old 10-28-2005, 08:14 AM   #3 (permalink)
sugarless
Registered User
 
Join Date: Oct 2005
Posts: 3
sugarless is on a distinguished road
kind of.. now im a bit confused with the array/matrix differences, and how to check rows/columns.. and also start left corner as 1,1 not 0,0... i think my main problem is reading from a file into the array.. this is what i have so far;

Code:
#include "windows.h"
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"

int main(int argc, char* argv[])

{
	int nSodukuArray[9][9];

	ZeroMemory(nSodukuArray,sizeof(nSodukuArray));

	char sLineBuf[256];

	FILE *f = fopen("soduku.in","rt");

	int row = 0, col = 0;

	while (fgets(sLineBuf,255,f))
	{
		for (col=0; col<9; col++)
		{
			nSodukuArray[row][col] = sLineBuf[col] - '0';
		}
		row++;
	}
	fclose(f);

	for (row = 0; row < 9; row++)
	{
		//...
	}

	for (col = 0; col < 9; col++)
	{
		//...
	}
	return 0;

}
sugarless is offline   Reply With Quote