Monday, May 24, 2010

How can I convert this program(in c++) to Prolog (winprolog or ..) ?

I've written the program in c++ but I can't convert it to Prolog .


main()


{


int x,y,bound;


cout%26lt;%26lt; "Enter 2 num to find the path";


cin %26gt;%26gt;x;


cin%26lt;%26lt; y;


bound=y-x;


while ( bound!=0)


{


if (bound%26gt;=100)


{


x+=100;


cout %26lt;%26lt; "----%26gt; + 100" %26lt;%26lt;x;


bound=y-x;


}


else if (bound%26gt;=10)


{


//like actions in previous if


}


else if (bound%26gt;=1)


{


//like actions in previous if


}


else if(bound%26lt;=-100)


{


x-=100;


bound=y-x;


}


....


}


ofcourse it is not the complete code .


I 'm new in prolog


especialy I want to know how can I use while loop , in prolog.


please help me !


thanks in advance.

How can I convert this program(in c++) to Prolog (winprolog or ..) ?
Why are you using Prolog? Taking an AI class or something?


No comments:

Post a Comment