Discussion:
Another Error Question.
(too old to reply)
Greg Sinclair
2004-02-08 00:13:48 UTC
Permalink
If the input is not an integer but say a rational number, what do we do?

-Greg
Arshad Shahzad
2004-02-08 00:54:10 UTC
Permalink
When i print the values of all the literals that are being passed in the
the function litstatus i come up the the following results.(according to
cnf.1)
4
4
3
3
-4
-4
But is'nt it suppose to give me
1
2
4
-1
3
0
2
-3
-4
cus these are all the literals appearing in cnf.1
thanks
Alexander Smith
2004-02-08 18:30:34 UTC
Permalink
That really depends on how you've implemented litStatus(), clauseStatus(),
and checkAssignment(). Your checkAssignment() function will not always
need to examine all the cluases, and your clauseStatus() function will not
always need to examine every literal in the clause. Also remember that
your linked lists have the clauses stored in the opposite order to that
in which thay appear in the .cnf file.

If you're not sure if your program is operating correctly, try tracing it
through by hand, or stepping through it with gdb.

Alexander
Post by Arshad Shahzad
When i print the values of all the literals that are being passed in the
the function litstatus i come up the the following results.(according to
cnf.1)
4
4
3
3
-4
-4
But is'nt it suppose to give me
1
2
4
-1
3
0
(You should never be passing 0 in as a literal to litStatus().)
Post by Arshad Shahzad
2
-3
-4
cus these are all the literals appearing in cnf.1
thanks
Sherman
2004-02-08 05:32:49 UTC
Permalink
You should output an error message just as if the entry is not a number at
all (or other invalidities). Most of such invalid entry error handlings can
be done by utilitizing the integer value returned by fscanf upon sucessful
input.
U can refer to the post(s) regarding such topics before. I forgot which one.
Hope that helps.
Post by Greg Sinclair
If the input is not an integer but say a rational number, what do we do?
-Greg
Loading...