If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Please find the bug in the c++ code

Hello Paul,
I figured out that in the CheckPoss function, case 8 is not being checked .I tried to find the value of 'f' by inserting the comments , which u can see. But, I am still not able to find the bug.

Re: Please find the bug in the c++ code

Originally Posted by navy1991

Hello Paul,
I figured out that in the CheckPoss function, case 8 is not being checked .I tried to find the value of 'f' by inserting the comments , which u can see. But, I am still not able to find the bug.

As Paul pointed out you have to debug your code to find the bug!

Note also that noone will check your code until you will fromat it properly: with indentations and white spaces between operands.
Example: this is your unformatted code:

Re: Please find the bug in the c++ code

Originally Posted by navy1991

Hello Paul,
I figured out that in the CheckPoss function, case 8 is not being checked .I tried to find the value of 'f' by inserting the comments , which u can see. But, I am still not able to find the bug.

I will go back to your post earlier:

This is the c++ code written by me

You must have had a plan before you wrote the code, correct? So where in the program does the code deviate from this plan?

The point is that you wrote the code, therefore you must be able to debug the code that you wrote. You can't write C++ code and not know what to do when or if a bug in the logic occurs.

Re: Please find the bug in the c++ code

Originally Posted by navy1991

Hello Victor and Paul,

Here you go: This is the formatted code , which I am trying:

Why are you just "trying" the code? You must be confident that the code will do the job correctly. If it doesn't do the job, then you debug the code. This means that you must plan and design before you write one line of code. Then you write the code according to the plan/design.

Just writing code, seeing that it doesn't work, and then asking one of us to fix the code is not how programming works.

Re: Please find the bug in the c++ code

Hi Paul,
My plan was to follow the logic as explained for the BASIC program. With this in mind, I started writing my code. In BASIC programming, the array starts from 1, but in C++ it starts from 0. So, all the logic is same. Except that , everything starts from 0 instead of 1.

The code deviated from the plan when I started to write the Recurse and the CheckPoss function. I am sure that my bug is in these two functions. More specifically , I did not know what the CheckPoss function is returning in the BASIC program if the condition f = o is false.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.