Hopefully you all didn't mind if i ask some prolog question at here. Cos i finds that this board is the place that i can find the experience and best programmer from others site.
Ya, important part.
I have a difficulties in converting the the decimals number to hexadecimals and then convert it back. I know that we need to convert it first to binary rite and the nchange it to hex. But ont thing is i don have any clue on what command i need to use to convert it to binary and then convert it to hex. I have crack my head and still does not found any solutions.
So, does anyone willing to help me pls. I am using the SWI-prolog 3.2.8
And the Engrish of the day award goes to:
> I have crack my head and still does not found any solutions.
Seriously, if you're having trouble with it, post some code and im sure people will be able to point you in the right direction.
Thanks for giving me the green light to ask for help.
Currently i have think out an algorithm for the hexadecimals problem.
-First i make a database like this for the helping to convert back the
hexadecimals back to decimals value.
-Then i put a function to read the input from the keyboard the
hexadecimals values thats need to change to decimals.
And then, i change the input to a list as below:
-Using the mathematicals calculation, suppose the '2' should multiply
with the '16 power of 1' and adding with the '0' multiply with the
'16 power of 0'. And then adding together will comes out the value of
'32' which is the decimals value.
-What i have currently now are like this. I want to check with you
and see if this algorithm works first before i start the coding part.
Please advice. BTW, i have check some information from the web that
there is a predicate for the swi-prolog '\x' which use for the
I have try out the command like this:
1 -----instead should having the value of 32.
Does i using the wrong command. Please advice.
Thanks and waiting for your reply. Good Day.