小编Adr*_*ian的帖子

Prolog,如何在write()中显示多个输出

go :-   match(Mn,Fn),
        write('--Matching Result--'),
        nl,
        write(Mn),
        write(' match with '),
        write(Fn),
        match(Mn1,Fn1).


person(may,female,25,blue).
person(rose,female,20,blue).
person(hock,male,30,blue).
person(ali,male,24,blue).
match(Mn,Fn):-person(Fn,'female',Fage,Fatt),
person(Mn,'male',Mage,Matt),
Mage>=Fage,
Fatt=Matt.
Run Code Online (Sandbox Code Playgroud)

嗨,这是我的代码...但它只能显示1输出...但匹配中有3对匹配(X,Y).如何在我的go函数中显示它们.

谢谢

prolog

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

prolog ×1