Ejercicios Prolog
August 28, 2022 | Author: Anonymous | Category: N/A
Short Description
Download Ejercicios Prolog...
Description
/* Prlarjcj qug djeej ge cgolr y ge cjylr bg = oucgrls koargsjbls */ blcjkos oucgrl 3 kotgagr
prgbkmjtgs olobgtgrc cjx\cko(oucgrl,oucgrl,oucgrl,oucgrl,oucgrl) cjx\cko(oucgrl,oucgrl,oucgrl,oucgrl,oucgrl)
mejusgs cjx\cko(O:,O6,O=,Cj,Cg) >- O:5O6 , O: 5O=, 5O=, O6 5 O= , Cj 3 O=, Cg 3 O O:, :, wrktg("ge cjylr gs> "), wrktg(Cj),oe,wrktg("Ge cgolr gs> "),wrktg(Cg),oe.
alje wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg("*** wrktg("
***"),oe,
Prlarjcj qug mjemuej ge cjylr y cgolr
wrktg("***
"),oe,
***"),oe,
wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg("Koargsg ge prkcgr oucgrl> "), rgjbkot(O:), wrktg("Koargsg ge sgauobl oucgrl> "), rgjbkot(O6), wrktg("Koargsg ge tgrmgr oucgrl> "), rgjbkot(O=), cjx\cko(O:,O6,O=,Cj,Cg).
/* prlarjcj qug bgvugevg ge oucgrl bg fkeegtgs l clogbjs */ blcjkos lpmklo 3 mdjr mjotkbjb 3 kotgagr mjcfkl 3 rgje prgbkmjtgs olobgtgrc mjcfkl\bkogrl(lpmklo,mjotkbjb,mjcfkl)
mejusgs mjcfkl\bkogrl(Lpm, Mjot, Mjcf) >- Lpm 3 'b' , Mjcf 3 Mjot / 6.40. 6.40 .
alje wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg ("*** wrktg("
***"),oe,
Prlarjcj qug mjemuej ge tkpl bg mjcfkl"),oe,
wrktg("***
***"),oe,
wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg("oargsg ge tkpl bg mjcfkl 5 b - g? > "), rgjbmdjr(Lpm), oe, wrktg("Koargsg ej mjotkbjb j mjcfkjr> "), rgjbkot(Mjot), oe, mjcfkl\bkogrl(Lpm, Mjot, Mjcf).
/* Prlarjcj qug koargsjbl = oucgrls els bgvugevg lrbgojbls go ilrcj bgmrgmkgotg */ blcjkos oucgrl 3 kotgagr
prgbkmjtgs olobgtgrc lrbgojbls\bgsm(oucgrl,oucgrl,oucgrl,oucgrl,oucgrl,ou lrbgojbls\bgsm(oucgrl,oucgrl,oucgrl,oucgrl,oucgrl,oucgrl) cgrl)
mejusgs lrbgojbls\bgsm(O:,O6,O=,T,[,^) >- O:5O6, O:5O=,O65O=, T3O=,[ 3O6,^ 3O:, wrktg("lrbgojbls go ilrcj bgsmgobgotg> "),oe, wrktg(T),wrktg(" "), wrktg([), wrktg(" "),wrktg(^),oe. lrbgojbls\bgsm(O:,O6,O=,T,[,^) >- O65O:, O65O=,O:5O=, T3O=,[ 3O:,^ 3O6.
alje
wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg("*** wrktg("
***"),oe,
Prlarjcj qug lrbgoj trgs oucgrls r
wrktg("***
"),oe,
***"),oe,
wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg("Koargsg ge prkcgr oucgrl> "), rgjbkot(O:), wrktg("Koargsg ge sgauobl oucgrl> "), rgjbkot(O6), wrktg("Koargsg ge tgrmgr oucgrl> "), rgjbkot(O=), lrbgojbls\bgsm(O:,O6,O=,T,[,^).
komeubg "mejsg2.kom"
blcjkos lpmklo 3 kotgagr
mjotkbjb 3 kotgagr
prgbkmjtgs olobgtgrc mjcfkl\bkogrl(lpmklo, mjotkbjb , mjotkbjb)
mejusgs mjcfkl\bkogrl(Lpm,Mjot, Mjcf)>- Lpm 3 :, Mjcf 3 Mjot/:0, wrktg("Ej mjotkbjb bg fkeegtgs bg :0 gs> "), wrktg(Mjcf), oe. mjcfkl\bkogrl(Lpm,Mjot, Mjcf)>- Lpm 3 6, Mjcf: 3 Mjot/7, wrktg("Ej mjotkbjb bg clogbjs bg 7 slegs gs> "), wrktg(Mjcf:), oe, Mjcf6 3 Mjot/6,wrktg("Ej mjotkbjb bg clogbjs bg 6 slegs gs> "), wrktg(Mjcf6), oe, Mjcf3 Mjcf: + Mjcf6.
alje wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg ("*** wrktg("
***"),oe,
Prlarjcj qug mjemuej ge tkpl bg mjcfkl"),oe,
wrktg("***
***"),oe,
wrktg("*********************** wrktg("*********** *********************** ********************** ***************"),oe, ****"),oe, wrktg("Zug tkpl bg mjcfkl bgsgj 5 :. fkeegtgs 6. clogbjs? > "), rgjbkot(Lpm), oe, wrktg("Koargsg ej mjotkbjb j mjcfkjr> "), rgjbkot(Mjot), oe,
mjcfkl\bkogrl(Lpm, Mjot,\).
View more...
Comments