| | |
SUDOKU
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2009
Posts: 10
Reputation:
Solved Threads: 0
You can insert a no. at any pt. in this program. here is the code:
run this code in your TC.
you need to copy the foll. in TC
GOTO.C
please see attachment goto.c
please let me know how can i check that my filled sudoku is right or wrong. (note that it is not necessary to fill first blank first , i can fill it randomly)
c Syntax (Toggle Plain Text)
#include<stdio.h> #include<conio.h> #include<process.h> #include"goto.c" void line(void); void cross(void); int main() { clrscr(); int a[9][9]={8,6,7,5,4,2,3,9,1, 4,3,2,9,1,8,5,7,6, 9,5,1,7,6,3,4,2,8, 5,2,9,6,8,4,7,1,3, 7,4,8,3,5,1,2,6,9, 6,1,3,2,7,9,8,5,4, 1,8,5,4,2,6,9,3,7, 2,9,6,8,3,7,1,4,5, 3,7,4,1,9,5,6,8,2}, b[9][9]= {8,6,' ',' ',' ',' ',' ',9,' ', 4,' ',2,' ',1,' ',5,' ',' ', ' ',5,' ',7,' ',3,' ',' ',8, 5,' ',' ',6,8,4,' ',1,' ', ' ',4,' ',' ',' ',' ',2,6,' ', ' ',' ',3,2,7,9,8,' ',4, ' ',' ',' ',' ',' ',6,' ',' ',7, 2,' ',6,8,3,7,1,' ',' ', ' ',7,4,' ',' ',' ',' ',8,2},i,j,r=0,c=0,ch,n; textcolor(55); {cprintf("\n READ THE INSTRUCTIONS CAREFULLY"); printf("\n\n\n"); textcolor(GREEN); cprintf("1.) FILL NO.S FROM 1 TO 9 IN EVERY ROW , COLUMN & 3*3 BOX"); printf("\n"); cprintf(" 2.) NO Number SHOULD REPEAT MORE THAN ONCE");} delay(10000); textcolor(55); clrscr(); for(i=0;i<9;i++) { printf("\n"); for(j=0;j<9;j++) {printf("%3d",b[i][j]); if (b[i][j]==32) printf("\b\b _");} printf("\n"); } gotorc(0,0); printf("%c",218); for(i=0;i<17;i++) printf("\n%c",179); printf("\n%c",192); line(); gotorc(0,1);line(); gotorc(6,1);line(); gotorc(12,1);line(); gotorc(0,9);cross(); gotorc(0,18);cross(); gotorc(0,27);cross(); gotorc(6,31); printf("1.use errow key to move"); gotorc(7,31); printf("2.press insert to insert a no. & then press enter"); gotorc(8,31); printf("3.insert a no. at blank given"); gotorc(0,0); while(1) { ch=getkey(); switch(ch) { case 77: gotorc(r,++c); break; case 80: { gotorc(++r,c); break; } case 75: { gotorc(r,--c); break; } case 1: exit(0); case 72: gotorc(--r,c);break; case 82: scanf("%d",&n); gotorc(r,c); printf("%d",n); } } getch(); return(0); } void line(void) { int i; for(i=0;i<27;i++) cprintf("%c",196); } void cross(void) { int i; for(i=0;i<=18;i++) { if(i==0) cprintf("%c\n",194); else if(i==6||i==12) cprintf("\b%c\n",197); else if(i==18) cprintf("\b%c\n",193); else cprintf("\b%c\n",179); } }
run this code in your TC.
you need to copy the foll. in TC
GOTO.C
please see attachment goto.c
please let me know how can i check that my filled sudoku is right or wrong. (note that it is not necessary to fill first blank first , i can fill it randomly)
Last edited by WaltP; Oct 27th, 2009 at 3:19 am. Reason: Added CODE tags -- with all the help about them, how could you miss using them????
1
#2 Oct 26th, 2009
if you would like to get a meaningful response, please consider the following:
How to Ask a Question
Please Use Code Tags
How to Ask a Question
Please Use Code Tags
![]() |
Similar Threads
- Sudoku Source Code (C++)
- Sudoku Source Code. (C#)
- Please help! Sudoku in C (C)
Other Threads in the C Forum
- Previous Thread: how can i treate with execvp?!!
- Next Thread: c language software
Views: 475 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks binarysearch calculate centimeter char command convert copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax directory dynamic executable fflush file fork forloop frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix problem probleminc program programming radix recursion recv repetition research scanf scheduling scripting segmentationfault send sequential shape socketprograming spoonfeeding stack standard string strings structures student systemcall testautomation turboc unix user variable voidmain() wab win32 windows.h






