Click here to Skip to main content
15,890,438 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: parameter question Pin
Christian Graus27-Jul-06 11:16
protectorChristian Graus27-Jul-06 11:16 
GeneralRe: parameter question Pin
Jay0328-Jul-06 5:53
Jay0328-Jul-06 5:53 
GeneralRe: parameter question Pin
Christian Graus28-Jul-06 10:45
protectorChristian Graus28-Jul-06 10:45 
GeneralRe: parameter question Pin
Jay0328-Jul-06 7:07
Jay0328-Jul-06 7:07 
AnswerRe: parameter question Pin
toxcct27-Jul-06 21:34
toxcct27-Jul-06 21:34 
GeneralRe: parameter question Pin
Jay0328-Jul-06 7:00
Jay0328-Jul-06 7:00 
AnswerRe: parameter question Pin
Zac Howland28-Jul-06 9:34
Zac Howland28-Jul-06 9:34 
QuestionHelp::i have made a sudoku solver but it not workin Pin
keshava shukla27-Jul-06 9:00
keshava shukla27-Jul-06 9:00 
// D'Oh! | :doh: hey here goes the program i have made pls help me out to find errors
#include <iostream.h>
//#include <graphics.h>
#include <conio.h>
#include <stdio.h>
#include <process.h>

class sudoku{
int a[9][9][10],count;
public:
sudoku();
void initsudoku();
void redprob(int , int);
void dispsudoku();
void fillele(int , int );
void fillsudoku();

} ;
sudoku::sudoku()
{ int i , j ,k;
count=81;
cout<<"constructor";
for( i=1;i<=9;i++)
for ( j=1;j<=9;j++){
a[i][j][0]=99;
for ( k=1;k<=9;k++)
a[i][j][k]=0;
a[i][j][10]=9;
}
}
void sudoku::redprob(int i, int j )
{
int k,l,temp;
temp=a[i][j][0];
for ( k=1;k<=9;k++)
{
if (( k!=j) && (a[i][k][temp]!=99));
{ a[i][k][temp] = 99;
a[i][k][10]--;
if(a[i][k][10]==1)
fillele(i,k);

}
if (( k!=i)&&(a[k][j][temp]!=99));
{ a[k][j][temp] = 99;
a[k][j][10]--;
if(a[k][j][10]==1)
fillele(k,j);

}
}
cout<<"l"<<temp;
int="" h="i/3,g=j/3;
" for(="" k="0;k<3;k++)
" {="" l="0;l<3;l++){
" if((="" i!="h*3+k)||(j!=g*3" +l))
="" a[h*3="" +k][g*3="" +l][temp]="99;
" if="" (a[h*3="" +l][10]="=1)
" fillele(h*3="" +k,g*3="" +l);
="" }
="" }

="" }


="" void="" sudoku::initsudoku()
="" {

="" i,j,val;
="" char="" ch="y" ;
="" while(ch="='y')
" {
="" cout<<"enter="" the="" element="" ";
="" element\nrow="" no.";
="" cin="">>i;
cout<<"column no.";
cin>>j;
cout<<"enter value";
cin>>val;
if ((i<=9)&&(j<=9)&&(a[i][j][val]==0)&&(count<=0))
{
a[i][j][0]=val;
a[i][j][10]=0;
count--;
redprob(i,j);
}
else if (i>9)
cout<<"wrong row value";
else if (j>9)
cout<<"wrong column value";
else if (count<=0)
cout<<"already 81 elements have been identified";
else cout<<" you can not place this value here";
cout<<"enter any other element ";
cin>>ch;
}

}




void sudoku::fillele(int i, int j )
{ for( int k=1; k<=9;k++)
if( a[i][j][k] == 0){
a[i][j][0] = k;
a[i][j][10]=0;
count--;
redprob(i,j);
}
}
void sudoku::dispsudoku()
{ int i,j;


for( i=1;i<=9;i++)
{
for ( j=1;j<=9;j++){
if(a[j][i][0]>10){

cout<<" ";
}
else {
cout<
AnswerRe: Help::i have made a sudoku solver but it not workin Pin
David Crow27-Jul-06 10:49
David Crow27-Jul-06 10:49 
AnswerRe: Help::i have made a sudoku solver but it not workin Pin
Christian Graus27-Jul-06 11:17
protectorChristian Graus27-Jul-06 11:17 
QuestionC++ question Pin
Alex_Y27-Jul-06 8:56
Alex_Y27-Jul-06 8:56 
AnswerRe: C++ question Pin
valikac27-Jul-06 9:01
valikac27-Jul-06 9:01 
GeneralRe: C++ question Pin
Alex_Y27-Jul-06 9:07
Alex_Y27-Jul-06 9:07 
GeneralRe: C++ question Pin
valikac27-Jul-06 9:20
valikac27-Jul-06 9:20 
GeneralRe: C++ question Pin
Alex_Y27-Jul-06 9:26
Alex_Y27-Jul-06 9:26 
GeneralRe: C++ question Pin
Alex_Y27-Jul-06 9:41
Alex_Y27-Jul-06 9:41 
AnswerRe: C++ question Pin
toxcct27-Jul-06 21:26
toxcct27-Jul-06 21:26 
GeneralRe: C++ question Pin
Alex_Y28-Jul-06 1:57
Alex_Y28-Jul-06 1:57 
GeneralRe: C++ question Pin
Zac Howland28-Jul-06 8:58
Zac Howland28-Jul-06 8:58 
Questionfunction header = 0 Pin
Jay0327-Jul-06 8:38
Jay0327-Jul-06 8:38 
AnswerRe: function header = 0 Pin
valikac27-Jul-06 9:03
valikac27-Jul-06 9:03 
GeneralRe: function header = 0 Pin
Jay0327-Jul-06 9:04
Jay0327-Jul-06 9:04 
GeneralRe: function header = 0 Pin
Alex_Y27-Jul-06 9:15
Alex_Y27-Jul-06 9:15 
AnswerRe: function header = 0 Pin
markkuk27-Jul-06 11:42
markkuk27-Jul-06 11:42 
QuestionHow to Load Bitmap in CImageList from outside????? [modified] Pin
MacGadger27-Jul-06 8:00
MacGadger27-Jul-06 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.